Net_GameServerQuery
[ class tree: Net_GameServerQuery ] [ index: Net_GameServerQuery ] [ all elements ]

Source for file example2.php

Documentation is available at example2.php

  1. <html>
  2. <head>
  3.     <title>Net_GameServerQuery Example 2: Using protocol parsers</title>
  4. </head>
  5. <body>
  6. <h1>Net_GameServerQuery Example 2: Using protocol parsers</h1>
  7. <p>This example shows how the protocol parsers can be accessed with Net_GameServerQuery.</p>
  8. <p>We convert a rules, status and players sample request into parsed data.</p>
  9. <p>This example requires <em>examplepackets.php</em> to be in the same directory.</p>
  10. <pre>
  11. <?php
  12. require_once 'Net/GameServerQuery.php';
  13.  
  14. // Raw packets from the server
  15. require 'examplepackets.php';
  16.  
  17. // Load HalfLife protocol
  18. $parser Net_GameServerQuery_Process::factory('HalfLife');
  19.  
  20. // Get rules from the packet
  21. $rules $parser->parse('rules'$packets['HalfLife']['rules']);
  22.  
  23. // Results
  24. print_r($rules);
  25.  
  26. ?>
  27. </pre>
  28. </body>
  29. </html>

Documentation generated on Mon, 11 Mar 2019 15:39:46 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.