title: Website Uptime Online/Offline PHP Script
body: <p>This is what I currently have. It doesn't work, what needs to be done to fix it?</p>
  
  <pre><code>&lt;?php
  $status =  GetServerStatus('http://domain.com',80)
  ?&gt;
  
  &lt;?php
  function GetServerStatus($site, $port)
  {
      $status = array("OFFLINE", "ONLINE");
      $fp = @fsockopen($site, $port, $errno, $errstr, 2);
  
      if (!$fp) {
          return $status[0];
      } else { 
          return $status[1];
      }
  }
  ?&gt;
  </code></pre>