title: PHP fsockopen() : local test server vs remote server
body: <p>I'm hoping there is a quirk about apache/php that I'm missing.</p>
  
  <p>The Code:</p>
  
  <pre><code>&lt;?php
      $servers = array(
          array("70.89.xxx.226",25565,''),
          array("50.22.xxx.147",25591,''),
      );
  
      foreach($servers as $key=&gt;$server){
          $fp = @fsockopen($server[0],$server[1],$errno,$errstr,.5);
          if(!$fp) {
              $servers[$key][2] = "DOWN";
          } else {
              $servers[$key][2] = "UP";
              @fclose($fp);
          }
          unset($fp);
      }
  
  
      echo"
      &lt;table&gt;
          &lt;thead&gt;
              &lt;td&gt;Minecraft Server Status&lt;/td&gt;
          &lt;/thead&gt;";
  
      foreach ($servers as $key=&gt;$server){
          $keyplus = $key + 1;
          echo"
          &lt;tr&gt;
              &lt;td&gt;Server $keyplus: $server[0]:$server[1]&lt;/td&gt;
              &lt;td&gt;$server[2]&lt;/td&gt;
          &lt;/tr&gt;";
      }
  
      echo "
      &lt;/table&gt;";
      ?&gt;
  </code></pre>
  
  <p>What it does: check connectivity to a variety of minecraft servers with the fsockopen function. </p>
  
  <p>The problem: This code does exactly what it's supposed to do on both my local and my remote web servers. However, on my remote server, the status always displays as DOWN even when I know they are UP, they also display as UP on my local server. I can't figure out WHY my host wouldn't be able to reach these servers, so I hope its a server quirk i don't know about.</p>
  
  <p>How you can help: Maybe theres another way to effectively ping an IP in php that I could use? or maybe you know of a server setting that is effecting my connectivity.</p>
  
  <p>thank for reading and your time
  ~TylerTofWA</p>