Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Server status
Index -> Programming, PHP -> PHP Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Amailer




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, PHP -> PHP Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 1 Posts ]
Jump to:   


Style:  
Search: