Re: Using PHP to test if server is online
| From: | Christian Reiniger | Date: | Tue, 03 Jul 2001 13:08:12 +0000 |
| Subject: | Re: Using PHP to test if server is online | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55983@lists.php.net to get a copy of this message | ||
On Tuesday 03 July 2001 07:47, Vikram Vaswani wrote:
> I am writing a PHP script to test if the server on which it is running
> is currently connected to the Internet. If so, the main page will
> display a notice saying "We are now online", else it will say "Not
> connected"
>
> Any ideas on how to do this with PHP? I'm guessing it would involve
> some kind of socket connection...
if ($Handle = fopen ("http://slashdot.org/",
"r")) {
echo "We're NOT online";
fclose ($Handle);
} else {
echo "We're online";
}
--
Christian Reiniger
LGDC Webmaster (http://lgdc.sunsite.dk/)
..10001000110101011010101101011110111010113...????