Computer Science Canada

Server status

Author:  Amailer [ Sun Sep 26, 2004 7:48 am ]
Post subject:  Server status

Hello,
Im trying to check several server status (to see if their online or offline) at the same time. How do I make it so that the script doesn't have to always check the sites status, because it makes the page load really slow..
Im using this function
code:

function check_status($servers, $port) {

        $fp = @fsockopen($servers, $port, &$errno, &$errstr, 1);
       
        if(!$fp) {
                return false;
        } else {
                fclose($fp);
                return true;
        }

}


I just check if the port is accessible or not, if it isn't then display 'Offline' as the status else display 'Online'. This is done for about 5 or more servers at a time..

Also, would this function cause the script to possiablly create problems for php Rolling Eyes somehow?

Thanks.


: