title: How to ping UDP in php
body: <p>I have a question about pinging certain game servers to see if they are alive or not, most work fine with just your standard PHP ping but others are from steam... and steam is making it more difficult for me to just send a ping to see if it is alive or not, i tried Steam Condenser but... have no idea how to use it since there is no documentation.</p>
  
  <p><strong>my question</strong></p>
  
  <p>how can i ping UDP game servers such as Arma 2, Arma 3, etc. this is what i tried:</p>
  
  <pre><code>        $host = '128.0.0.1';
          $port =  1234; 
          $waitTimeoutInSeconds = 7; 
          if($fp = fsockopen("udp://".$host,$port,$errCode,$errStr))
          {   
             echo 'Online'; 
          }
          else
          {
             echo 'Offline';
          } 
  </code></pre>
  
  <p>the problem with that is that i always get "true" returned no matter what IP or port i use, how can i make this work?</p>
  
  <p><strong>EDIT</strong>
  I also tried</p>
  
  <pre><code>        $host = '128.0.0.1';
          $port = 1234; 
          $waitTimeoutInSeconds = 7; 
          if($fp = fsockopen("udp://".$host,$port,$errCode,$errStr))
          {
              $write = fwrite($fp,"x00");
              if (!$write)
              { 
              echo 'offline';
              }
              else
              {
                  echo 'online'; 
              }
          }
          else
          {
             echo 'offline';
          } 
          fclose($fp);
  </code></pre>
  
  <p>however with this one i get error code 0 which seems to be a problem with the initializing of the socket?</p>