title: Get the site status - up or down
body: <pre><code>&lt;?php
  $host = 'http://google.com';
  if($socket =@ fsockopen($host, 80, $errno, $errstr, 30)) {
  echo 'online!';
  fclose($socket);
  } else {
  echo 'offline.';
  ?&gt;
  </code></pre>
  
  <p>I'm using the above program to get the status of site. But I always get an offline message.
  Is there any mistake with the code?</p>