Re: checking for internet connection
| From: | Richard Lynch | Date: | Fri, 22 Jul 2005 06:43:10 +0000 |
| Subject: | Re: checking for internet connection | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-219190@lists.php.net to get a copy of this message | ||
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:
<?php
$internet = @fopen("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