Re: [PHP] Checking for internet connection.
Kim Madsen wrote on 23/12/2009 17:01: Okay, explanation excepted, E-mails can easily be misunderstood :-) May you have a merry Christmas (grab another cup of choco, just in case ;-)) correction: accepted Now _I'M_ gonna get a cup of chocolate :-) -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
Bob McConnell wrote on 23/12/2009 15:55: > The problem arises when too many of the relevant parts are also removed, > which happened far too often on this thread as well as others. When the > core context is not retained, the conversation drifts and quickly > becomes useless to either the early posters or later readers. just don't delete mails that are recent, delete after 3 months for instance? And if possible (I see some Exchange dirt in the mailheader :-)) use a mailclient that supports thread, I use Thunderbird and when subscribing to maillists this is really cool, I have a quick overview of the mails on the subject. > I did not mean to be rude, but to point out what I see as a serious > problem that has been growing on this list recently. On the other hand, > I have not had my cup of hot chocolate yet this morning, so am probably > not completely awake yet. Okay, explanation excepted, E-mails can easily be misunderstood :-) May you have a merry Christmas (grab another cup of choco, just in case ;-)) -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
On Wed, Dec 23, 2009 at 14:35, Bob McConnell wrote: > I don't keep copies of every message in any of the > dozens of mailing lists and news groups I follow, so there is no simple > way to go back through the conversation to figure out where it all came > from. Fortunately, other people keep complete archives for you: http://news.php.net/php.general http://marc.info/?l=php-general -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Checking for internet connection.
From: Kim Madsen > Bob McConnell wrote on 23/12/2009 14:35: >> From: Andy Shellam >> And I was pointing out that this would not be a valid test when there is a caching DNS on the LAN. >> >>> I also pointed out how to avoid caching issues - the >>> comment was aimed at the author of the message before mine. >>> Too much of the conversation and most of the attribution was stripped too early for this to be coherent. >>> Why the negativity? A question was asked and several >>> possible solutions were provided based on that original >>> question. All the "conversation" was relevant IMO. >> >> But long before it was done it was impossible to tell who had asked >> which questions, who had provided which answers and who had countered >> those answers. In several instances, replies appeared to be directed to >> the wrong individuals. > >> Some people here tend to go way too far when trimming context from >> replies. Yes, I know it gets difficult to read when there are more than >> ten or twelve levels of attribution, but stripping all but the last >> layer is even worse. > > No, that's called netetiquette, have a look at: > http://www.the-eggman.com/writings/etiquitte_1.html > > Quote: "When responding to E-Mail, don't quote the entire original > message in your reply. Only quote the relevant parts, and only to the > extent that they will help orient the recipient on your reply." The problem arises when too many of the relevant parts are also removed, which happened far too often on this thread as well as others. When the core context is not retained, the conversation drifts and quickly becomes useless to either the early posters or later readers. I did not mean to be rude, but to point out what I see as a serious problem that has been growing on this list recently. On the other hand, I have not had my cup of hot chocolate yet this morning, so am probably not completely awake yet. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
Hi Bob Bob McConnell wrote on 23/12/2009 14:35: From: Andy Shellam And I was pointing out that this would not be a valid test when there is a caching DNS on the LAN. I also pointed out how to avoid caching issues - the comment was aimed at the author of the message before mine. Too much of the conversation and most of the attribution was stripped too early for this to be coherent. Why the negativity? A question was asked and several possible solutions were provided based on that original question. All the "conversation" was relevant IMO. But long before it was done it was impossible to tell who had asked which questions, who had provided which answers and who had countered those answers. In several instances, replies appeared to be directed to the wrong individuals. Leaving the above for a reason. I find your answer to Andy rude and offensive! Remind me not to try to help you next time. Some people here tend to go way too far when trimming context from replies. Yes, I know it gets difficult to read when there are more than ten or twelve levels of attribution, but stripping all but the last layer is even worse. No, that's called netetiquette, have a look at: http://www.the-eggman.com/writings/etiquitte_1.html Quote: "When responding to E-Mail, don't quote the entire original message in your reply. Only quote the relevant parts, and only to the extent that they will help orient the recipient on your reply." (and this mail is not to start a flame war) Removing the participants names from the top should be a hanging offense. I don't keep copies of every message in any of the dozens of mailing lists and news groups I follow, so there is no simple way to go back through the conversation to figure out where it all came from. Well, because _you_ don't wanna follow proper netetiquette doesn't mean everyone else should violate those rules, does it? :-) And a merry christmas to you. -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Checking for internet connection.
From: Andy Shellam >> And I was pointing out that this would not be a valid >> test when there is a caching DNS on the LAN. > I also pointed out how to avoid caching issues - the > comment was aimed at the author of the message before mine. > >> Too much of the conversation and most of the attribution >> was stripped too early for this to be coherent. > > Why the negativity? A question was asked and several > possible solutions were provided based on that original > question. All the "conversation" was relevant IMO. But long before it was done it was impossible to tell who had asked which questions, who had provided which answers and who had countered those answers. In several instances, replies appeared to be directed to the wrong individuals. Some people here tend to go way too far when trimming context from replies. Yes, I know it gets difficult to read when there are more than ten or twelve levels of attribution, but stripping all but the last layer is even worse. Removing the participants names from the top should be a hanging offense. I don't keep copies of every message in any of the dozens of mailing lists and news groups I follow, so there is no simple way to go back through the conversation to figure out where it all came from. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
> > And I was pointing out that this would not be a valid test when there is > a caching DNS on the LAN. I also pointed out how to avoid caching issues - the comment was aimed at the author of the message before mine. > > Too much of the conversation and most of the attribution was stripped > too early for this to be coherent. Why the negativity? A question was asked and several possible solutions were provided based on that original question. All the "conversation" was relevant IMO.
RE: [PHP] Checking for internet connection.
From: Andy Shellam >> >> I'm confused... what's the problem with just trying to hit >> the update server? If you can then you check for updates, if >> not then you, erm, don't. Simples, no? > > True, I think I said this same thing in a previous post - I > suggested the DNS option if all the OP wanted to do was check > if an Internet connection was there. And I was pointing out that this would not be a valid test when there is a caching DNS on the LAN. Too much of the conversation and most of the attribution was stripped too early for this to be coherent. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
> > I'm confused... what's the problem with just trying to hit the update server? > If you can then you check for updates, if not then you, erm, don't. Simples, > no? True, I think I said this same thing in a previous post - I suggested the DNS option if all the OP wanted to do was check if an Internet connection was there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
Bob McConnell wrote on 21/12/2009 15:05: Both at home and at work there are caching DNS on the LAN. So a DNS request may come back with a valid IP address when the WAN connection is down. I still won't be able to connect to the remote site. Then use fopen() to read a page you know exists? -- Kind regards Kim Emax - masterminds.dk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Checking for internet connection.
On Tue, 2009-12-22 at 08:27 -0500, Bob McConnell wrote: > From: Andy Shellam > > >> > >> Both at home and at work there are caching DNS on the LAN. So a DNS > >> request may come back with a valid IP address when the WAN connection > is > >> down. I still won't be able to connect to the remote site. > > > > Dig an external server - e.g. dig @a.root-servers.net google.co.uk > > > > If your net is down the query will fail even if the reply is > > cached locally, because you're specifically requesting a response > > from a.root-servers.net. > > What means dig? I can't find it in the function index of the online > manual. > > Bob McConnell > It's not a PHP thing, it's a network thing (Domain Information Groper) http://en.wikipedia.org/wiki/Domain_Information_Groper Thanks, Ash http://www.ashleysheridan.co.uk
RE: [PHP] Checking for internet connection.
From: Andy Shellam >> >> Both at home and at work there are caching DNS on the LAN. So a DNS >> request may come back with a valid IP address when the WAN connection is >> down. I still won't be able to connect to the remote site. > > Dig an external server - e.g. dig @a.root-servers.net google.co.uk > > If your net is down the query will fail even if the reply is > cached locally, because you're specifically requesting a response > from a.root-servers.net. What means dig? I can't find it in the function index of the online manual. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
On 21 Dec 2009, at 19:40, Andy Shellam wrote: >> >> Both at home and at work there are caching DNS on the LAN. So a DNS >> request may come back with a valid IP address when the WAN connection is >> down. I still won't be able to connect to the remote site. > > Dig an external server - e.g. dig @a.root-servers.net google.co.uk > > If your net is down the query will fail even if the reply is cached locally, > because you're specifically requesting a response from a.root-servers.net. I'm confused... what's the problem with just trying to hit the update server? If you can then you check for updates, if not then you, erm, don't. Simples, no? -Stuart -- http://stut.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
> > Both at home and at work there are caching DNS on the LAN. So a DNS > request may come back with a valid IP address when the WAN connection is > down. I still won't be able to connect to the remote site. Dig an external server - e.g. dig @a.root-servers.net google.co.uk If your net is down the query will fail even if the reply is cached locally, because you're specifically requesting a response from a.root-servers.net.
Re: [PHP] Checking for internet connection.
On Sat, Dec 19, 2009 at 19:13, Angus Mann wrote: > Hi all. > > I'w writing a PHP app that is designed to run over a LAN, so internet > connection for the server is not really essential. Some users may > deliberately not connect it to the internet as a security precaution. > > But I'd like the app to make use of an internet connection if it exists to > check for an update, and notify the user. > > Is there a simple way for a PHP script to check if it has an internet > connection? If it's running on Linux, this will work. For other OS'es, you may have to tweak it a bit. This executes a system call to the PING utility, which then sends a single packet with a deadline of 3 seconds to the address. If it causes anything but a 0 return on STDERR, it dies with the message "Internet connection unavailable." Don't use name-based lookups unless you absolutely have to in this case. There are more points of failure and bottlenecking, which can make your code run really slow or fail completely. -- daniel.br...@parasane.net || danbr...@php.net http://www.parasane.net/ || http://www.pilotpig.net/ Looking for hosting or dedicated servers? Ask me how we can fit your budget! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Checking for internet connection.
From: Andy Shellam >> By attempting to connect you will implicitly query DNS (which itself >> is a connection to server). > > No it's not - it's putting out a packet targeted at an IP address > and hoping a server will answer - hence why multi-cast works for > DNS because you're not directly connecting to a specified server, > like you do with TCP/IP. I believe it's similar for ping which is > why it's used so commonly in monitoring applications. > > > If you're not online you won't be able to >> resolve the domain name. > > Exactly - so if all the OP wanted to check for was a working > Internet connection, then DNS is a better way to go IMHO. Both at home and at work there are caching DNS on the LAN. So a DNS request may come back with a valid IP address when the WAN connection is down. I still won't be able to connect to the remote site. Bob McConnell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
> By attempting to connect you will implicitly query DNS (which itself > is a connection to server). No it's not - it's putting out a packet targeted at an IP address and hoping a server will answer - hence why multi-cast works for DNS because you're not directly connecting to a specified server, like you do with TCP/IP. I believe it's similar for ping which is why it's used so commonly in monitoring applications. > If you're not online you won't be able to > resolve the domain name. Exactly - so if all the OP wanted to check for was a working Internet connection, then DNS is a better way to go IMHO. > Hence no overhead of actually connecting, > because that won't even start to happen until the hostname is resolved > to an IP. If it happens to resolve from some cache, oh well. Not > like its that much overhead. You're nitpicking over the number of > packets it takes to SYN/ACK. Yep and if it's running inside a LAN with x number of computers all doing the same thing, that mounts up to a lot of unnecessary traffic - I've seen it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
On Sun, Dec 20, 2009 at 2:32 AM, Andy Shellam wrote: >> >> I think the only way to detect if it can connect to the Internet is to >> see if you can grab a file from somewhere on the Internet. I'd hazard a >> guess that when operating systems are able to tell you they can "connect >> to the Internet" they are actually saying they can ping a predetermined >> remote host. I think checking if PHP can grab a remote file with Curl >> would be sufficient in this case. > > Personally, I'd do a DNS lookup - even connecting to a server is a lot more > overhead than a simple DNS request. You could force the DNS server to be one > external to your network - e.g. dig @a.root-servers.net www.google.co.uk. If > the dig command fails, you're not connected. > > Or just try and get the update anyway - if the download fails, you're not > connected (or there's something wrong with the update server.) By attempting to connect you will implicitly query DNS (which itself is a connection to server). If you're not online you won't be able to resolve the domain name. Hence no overhead of actually connecting, because that won't even start to happen until the hostname is resolved to an IP. If it happens to resolve from some cache, oh well. Not like its that much overhead. You're nitpicking over the number of packets it takes to SYN/ACK. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
> > I think the only way to detect if it can connect to the Internet is to > see if you can grab a file from somewhere on the Internet. I'd hazard a > guess that when operating systems are able to tell you they can "connect > to the Internet" they are actually saying they can ping a predetermined > remote host. I think checking if PHP can grab a remote file with Curl > would be sufficient in this case. Personally, I'd do a DNS lookup - even connecting to a server is a lot more overhead than a simple DNS request. You could force the DNS server to be one external to your network - e.g. dig @a.root-servers.net www.google.co.uk. If the dig command fails, you're not connected. Or just try and get the update anyway - if the download fails, you're not connected (or there's something wrong with the update server.)
Re: [PHP] Checking for internet connection.
The next way to handle this might be to code an AIR app. Then it's a simple js trap to see if connectivity exists. Bastien Sent from my iPod On Dec 19, 2009, at 7:13 PM, "Angus Mann" wrote: Hi all. I'w writing a PHP app that is designed to run over a LAN, so internet connection for the server is not really essential. Some users may deliberately not connect it to the internet as a security precaution. But I'd like the app to make use of an internet connection if it exists to check for an update, and notify the user. Is there a simple way for a PHP script to check if it has an internet connection? I thought of this : if(fsockopen("www.google.com", 80)){ // we are connected } Is this OK or is there something better for the purpose? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
Curl_init() will return a resource or false if it fails, like it would if no Internet connection were present. J Corry Sent from my iPhone On Dec 19, 2009, at 5:36 PM, "Angus Mann" wrote: Why can't you put the update on the same LAN server that the app resides? If that is not possible, what about using CURL, and update if it can connect successfully, but don't if it cannot? Thanks, Ash http://www.ashleysheridan.co.uk Since the LAN is remote (many hundreds of miles away) from the source of the update, the only practical way to deliver an update every month or week to multiple users is to make it available for download from a central "update server". I'm just trying to maximize efficiency by checking if an internet connection exists, and abandoning further attempts to check for update availability if it does not. The idea to use CURL seems valid, but it pre-supposes that I know the answer to my own question. To use your suggestion, I'd have to have some mechanism to detect if it "can connect successfully". I'm asking what that mechanism should be, and if the one I've suggested is good, or flawed in some way. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Checking for internet connection.
On Sun, 2009-12-20 at 10:36 +1000, Angus Mann wrote: > Why can't you put the update on the same LAN server that the app resides? > > If that is not possible, what about using CURL, and update if it can connect > successfully, but don't if it cannot? > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > Since the LAN is remote (many hundreds of miles away) from the source > of the update, the only practical way to deliver an update every month or > week to multiple users is to make it available for download from a central > "update server". > > I'm just trying to maximize efficiency by checking if an internet > connection exists, and abandoning further attempts to check for update > availability if it does not. > > The idea to use CURL seems valid, but it pre-supposes that I know the > answer to my own question. To use your suggestion, I'd have to have some > mechanism to detect if it "can connect successfully". I'm asking what that > mechanism should be, and if the one I've suggested is good, or flawed in some > way. > > > > I think the only way to detect if it can connect to the Internet is to see if you can grab a file from somewhere on the Internet. I'd hazard a guess that when operating systems are able to tell you they can "connect to the Internet" they are actually saying they can ping a predetermined remote host. I think checking if PHP can grab a remote file with Curl would be sufficient in this case. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Checking for internet connection.
Why can't you put the update on the same LAN server that the app resides? If that is not possible, what about using CURL, and update if it can connect successfully, but don't if it cannot? Thanks, Ash http://www.ashleysheridan.co.uk Since the LAN is remote (many hundreds of miles away) from the source of the update, the only practical way to deliver an update every month or week to multiple users is to make it available for download from a central "update server". I'm just trying to maximize efficiency by checking if an internet connection exists, and abandoning further attempts to check for update availability if it does not. The idea to use CURL seems valid, but it pre-supposes that I know the answer to my own question. To use your suggestion, I'd have to have some mechanism to detect if it "can connect successfully". I'm asking what that mechanism should be, and if the one I've suggested is good, or flawed in some way.
Re: [PHP] Checking for internet connection.
On Sun, 2009-12-20 at 10:13 +1000, Angus Mann wrote: > Hi all. > > I'w writing a PHP app that is designed to run over a LAN, so internet > connection for the server is not really essential. Some users may > deliberately not connect it to the internet as a security precaution. > > But I'd like the app to make use of an internet connection if it exists to > check for an update, and notify the user. > > Is there a simple way for a PHP script to check if it has an internet > connection? > > I thought of this : > > if(fsockopen("www.google.com", 80)){ > // we are connected > } > > Is this OK or is there something better for the purpose? > > > Why can't you put the update on the same LAN server that the app resides? If that is not possible, what about using CURL, and update if it can connect successfully, but don't if it cannot? Thanks, Ash http://www.ashleysheridan.co.uk
[PHP] Checking for internet connection.
Hi all. I'w writing a PHP app that is designed to run over a LAN, so internet connection for the server is not really essential. Some users may deliberately not connect it to the internet as a security precaution. But I'd like the app to make use of an internet connection if it exists to check for an update, and notify the user. Is there a simple way for a PHP script to check if it has an internet connection? I thought of this : if(fsockopen("www.google.com", 80)){ // we are connected } Is this OK or is there something better for the purpose? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking for internet connection
On Wed, July 20, 2005 12:49 am, Steven said: > I am looking for a simple way to check if the server is connected to the > Internet, they use a dialup to get Internet connection, and I need to > email reports out, but want to check to see if the user remembered to > connect to the Internet first. If anybody has a nice script, or just a > suggestion on a php function I could use to test for an Internet > connection. I suppose this might work: http://php.net";); if (!$internet){ //They are not currently on-line. } else{ //They are on-line. } ?> It might be better to simply send the email using some kind of mail software which will either store it until they ARE connected, or that just connects automatically. This is on Windows? In the distant past, many folks recommended Pegasus email client -- it can be run from DOS promt, and hence from http://php.net/exec, to send out emails, and I would assume it handles the Internet connection somewhat gracefully. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] checking for internet connection
Assuming they connect to check their email every now and then, you do realize people will still receive your email regardless of whether their connection is up or not? The emails reside on the email server until the user retrieves them. - Original Message - From: "Steven" <[EMAIL PROTECTED]> To: "PHP General" Sent: Wednesday, July 20, 2005 3:49 AM Subject: [PHP] checking for internet connection Hi I am looking for a simple way to check if the server is connected to the Internet, they use a dialup to get Internet connection, and I need to email reports out, but want to check to see if the user remembered to connect to the Internet first. If anybody has a nice script, or just a suggestion on a php function I could use to test for an Internet connection. Thanks steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checking for internet connection
Hi I am looking for a simple way to check if the server is connected to the Internet, they use a dialup to get Internet connection, and I need to email reports out, but want to check to see if the user remembered to connect to the Internet first. If anybody has a nice script, or just a suggestion on a php function I could use to test for an Internet connection. Thanks steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] checking for internet connection
Hi I am looking for a simple way to check if the server is connected to the Internet, they use a dialup to get Internet connection, and I need to email reports out, but want to check to see if the user remembered to connect to the Internet first. If anybody has a nice script, or just a suggestion on a php function I could use to test for an Internet connection. Thanks steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php