PDA

View Full Version : Checking Remote Server


Brian
03-28-2002, 06:57 PM
Hello,

I am working on a script that will check to make sure a remote server is online, and if it is online include a file (on.php), and if the remote server is offline include the file (off.php) instead on the page.

If some one could show me how to do this I would be forever in there gratitude.

Thanks!

-Brian

Admin
03-29-2002, 06:21 AM
Use fsockopen() (http://php.fastmirror.com/manual/en/function.fsockopen.php) I think.

Brian
04-02-2002, 04:24 PM
I was wondering if anyone else could show me an example.

-Brian

Mark Hensler
04-02-2002, 07:06 PM
<?php
$fp = fsockopen ("www.php.net", 80);
if (!$fp) {
include('on.php');
} else {
fclose ($fp);
include('off.php');
}
?>