Source for file HalfLife.php
Documentation is available at HalfLife.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: HalfLife.php,v 1.18 2004/09/18 14:26:02 aidan Exp $
require_once 'Net\GameServerQuery\Protocol.php';
* @package Net_GameServerQuery
* @author Tom Buskens <ortega@php.net>
* @version $Revision: 1.18 $
* @return array Array containing formatted server response
private function _details ()
if (!$this->_match("\xFF\xFF\xFF\xFF\x6d")) {
throw new Exception ('Parsing error');
// Body regular expression
$body = "(([^\x00]+)\x00([^\x00]+)\x00([^\x00]+)\x00([^\x00]+)\x00"
. "([^\x00]+)\x00(.)(.)(.)(.)(.)(.)(.)";
$vars = array ('serverip', 'servername', 'mapname', 'gamedir',
'gamename', 'playercount', 'playermax',
'protocolversion', 'servertype', 'serveros',
'serverpassword', 'gamemod'
// Process and save variables
for ($i = 0 , $x = count($vars); $i != $x; $i++ ) {
throw new Exception ('Parsing error');
* @return array Array containing formatted server response
if (!$this->_match("\xFF\xFF\xFF\xFFinfostringresponse\x00")) {
throw new Exception ('Parsing error');
// Variable / value pairs
while ($this->_match("\\([^\\]+)\\([^\\\x00]*)")) {
throw new Exception ('Parsing error');
* @return array Array containing formatted server response
protected function _ping()
if ($this->_match("\xFF\xFF\xFF\xFF\n")) {
throw new Exception ('Parsing error');
* @return array Array containing formatted server response
if ($this->_match("\xFF\xFF\xFF\xFF\x44(.)")) {
//$this->_add('playercount', $this->toInt($this->_result[1]));
throw new Exception ('Parsing error');
while ($this->_match("(.)([^\x00]+)\x00(.{4})(.{4})")) {
* @return array Array containing formatted server response
// Remove the header of the possible second packet
if ($this->_match("\xFF\xFF\xFF\xFF\x45(.{2})")) {
throw new Exception ('Parsing error');
// Variable / value pairs
while ($this->_match("([^\x00]+)\x00([^\x00]*)\x00")) {
Documentation generated on Mon, 11 Mar 2019 13:58:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|