title: How to add email function to this php checking script?
body: <p>How to add email function to send if the port isnt responding (false) to this script below ?</p>
  
  <pre><code>&lt;?php
  
  function test_port($host,$port=80,$timeout=6)
  {
          $fsock = fsockopen($host, $port, $errno, $errstr, $timeout);
          if ( ! $fsock )
          {
                  return FALSE;
          }
          else
          {
                  return TRUE;
          }
  }
  
  /* check our website http://www.example.com is up and running (port 80) and timeout after 20 seconds */
  $ok = test_port('IP/website',80,20);
  
  ?&gt;
  </code></pre>