SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Server Status

  1. #1
    SitePoint Member Rezo||ProfitHost's Avatar
    Join Date
    Apr 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Talking Server Status

    This is a script that shows if your server is on/off

    PHP Code:
    <?PHP 
    function serverstatus($host$port) { 
      
    $sock = @fsockopen($host$port, &$num, &$error2); 
      if (
    $sock) { 
          if (
    getservbyport($port,"tcp")!=null) { 
              
    $serv getservbyport($port,"tcp"); 
          } else { 
              
    $serv "Unknown"
          } 
          echo 
    "<center>Server : <span style='color:green'>Online</span></center>"
          
    fclose($sock); 
          unset(
    $sock); 
      }else{ 
          echo 
    "<center>Server : <span style='color:red'>Offline</span></center>"
          unset(
    $sock); 
      } 


    //Ports To Scan 
    serverstatus("68.100.166.101"4000);

    ?>

  2. #2
    get into it! bigduke's Avatar
    Join Date
    May 2004
    Location
    Australia
    Posts
    847
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does it cater to unreliable networks too ?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •