Source for file GameSpy04.php
Documentation is available at GameSpy04.php
// +----------------------------------------------------------------------+
// +----------------------------------------------------------------------+
// | Copyright (c) 1997-2004 The PHP Group |
// +----------------------------------------------------------------------+
// | This source file is subject to version 3.0 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.php.net/license/3_0.txt. |
// | If you did not receive a copy of the PHP license and are unable to |
// | obtain it through the world-wide-web, please send a note to |
// | license@php.net so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// | Authors: Aidan Lister <aidan@php.net> |
// | Tom Buskens <ortega@php.net> |
// +----------------------------------------------------------------------+
// $Id: GameSpy04.php,v 1.13 2004/11/05 15:23:33 ortega Exp $
require_once 'Net\GameServerQuery\Protocol.php';
* @package Net_GameServerQuery
* @author Tom Buskens <ortega@php.net>
* @version $Revision: 1.13 $
* @return array Array containing formatted server response
// Variable / value pairs
while ($this->_match("([^\x00]+)\x00([^\x00]*)\x00")) {
* @return array Array containing formatted server response
if (!$this->_getValues ('player')) {
// Get team info (same packet)
* @param bool $from_players True if packet was also contained player data.
* @return array Array containing formatted server response
protected function _team($from_players = false )
if (!$this->_getValues ('team')) {
* @return bool True if matched, false if not
private function _getHeader ()
throw new Exception ('Parsing error: header not matched');
* Gets variables according to a specific pattern
* @param string $type Variable type
* @return bool True on success, false on pattern match failure
private function _getValues ($type)
if (!$this->_match("\x00(.)")) {
throw new Exception ('Parsing error');
// Convert byte to integer
$this->_add($type . 'count', $count);
// Get variable names, always start with an underscore
if (!$this->_match("_([^\x00]+)\x00")) {
// Variable name sequence is ended with a second \x00
$var_count = count($variables);
for ($i = 0; $i !== $count; $i++ ) {
// Get values for each set
for ($j = 0; $j !== $var_count; $j++ ) {
if (!$this->_match("([^\x00]+)\x00")) {
// Add variables to output
Documentation generated on Mon, 11 Mar 2019 13:58:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|