how to crate cheker for site that check server on or off

Results 1 to 3 of 3
  1. #1
    Account Upgraded | Title Enabled! dani627 is offline
    MemberRank
    Jun 2008 Join Date
    israelLocation
    368Posts

    how to crate cheker for site that check server on or off

    the title say it all


  2. #2
    Valued Member LegacyCode is offline
    MemberRank
    Aug 2009 Join Date
    HyruleLocation
    129Posts

    Re: how to crate cheker for site that check server on or off

    With the fsockopen() function in php
    if this is what you mean..

  3. #3
    Enthusiast byakuyabr is offline
    MemberRank
    May 2008 Join Date
    SomewhereLocation
    29Posts

    Re: how to crate cheker for site that check server on or off

    Using the function fsockopen like LegacyCode said:
    <?php
    $serverIsOn = 0;
    $serverAddress = "127.0.0.1"; // Change this variable with your server IP
    $MySQLPort = 3306; // Change this with your MySQL Port. The default is: 3306
    $loginServerPort = 23000; // Change this with your LoginServer Port
    $charServerPort = 28000; // Change this with your CharServer Port
    $worldServerPort = 15400; // Change this with your WorldServer Port

    if(@fsockopen($serverAddress, $MySQLPort, $errno, $errstr, 1)) {
    $serverIsOn++;
    }
    if(@fsockopen($serverAddress, $loginServerPort, $errno, $errstr, 1)) {
    $serverIsOn++;
    }
    if(@fsockopen($serverAddress, $charServerPort, $errno, $errstr, 1)) {
    $serverIsOn++;
    }
    if(@fsockopen($serverAddress, $worldServerPort, $errno, $errstr, 1)) {
    $serverIsOn++;
    }

    if($serverIsOn >= 4) {
    echo "Server is: <font color=green><b>Online</b></font>";
    } else {
    echo "Server is: <font color=red><b>Offline</b></font>";
    }
    ?>
    This is just an example. If you want to learn more about fsockopen function on php, check this: click here



Advertisement