Jump to content

Help me with getting...


Genert

Recommended Posts

Hello everyone.

Latly I have worked on server query script:

http://genert.impact.pri.ee/ser/server.php?ip=188.165.209.117:29000

You can type any Wolfenstein:ET server IP into end after ?ip=

But my idea has growed bigger.

I´m trying to get master server list in PHP,what shows all ET servers.Like here:

http://www.et.trackbase.net/index.php?mod=serverlist

SoI found this: http://eun.su.am/proj/q3masterquery/q3masterquery.phps

And followed script:

<?php
class Q3MasterQuery {
var $error;
var $result;
    function Q3MasterQuery($ip, $port, $prot, $keywords = '') {
	$servers = array();
	$this->error = 0;


	$fp = fsockopen('udp://etmaster.idsoftware.com:27950'.$ip, $port, $errno);
	if (!$fp) {
		$this->error = $errno;
	} else {
		fwrite($fp, chr(255).chr(255).chr(255).chr(255).'getservers ' . $prot. ' ' . $keywords);
		$buf = '';
		$chr = fgets($fp,2);
		// read until EOF / EOT comes up
		while (substr($buf,-2) != 'EO') {
		  $chr = fgets($fp,2);
		  $buf .= $chr;
		}
		// cut the EOF / EOT Off
		$buf = substr($buf,0,-3);

		// split it up			
		$n = explode('\\',$buf);
		foreach ($n as $server) {
			$len = strlen($server);
			if ($len == 6) {
				$ip = '';
				for ($j = 0; $j < $len-2; $j++) {
					$ip .= ord($server[$j]).'.';
				}
				$ip = substr($ip,0,-1);

				$port = (ord($server[$len-2])<< + ord($server[$len-1]);

				array_push($servers,array($ip,$port));
			}
		}
		fclose($fp);
		$this->error = 0;
	}
	$this->result = $servers;
    }
}
?>

 

Take a look at:

	$fp = fsockopen('udp://etmaster.idsoftware.com:27950'.$ip, $port, $errno);

 

But it gives me just white page: http://genert.impact.pri.ee/da.php  :confused:

Wheres problem?

 

Link to comment
https://forums.phpfreaks.com/topic/238026-help-me-with-getting/
Share on other sites

But it gives me just white page: http://genert.impact.pri.ee/da.php  :confused:

Wheres problem?

White pages are usually indicative of fatal errors.  You can detect these errors by placing these 2 lines directly after your opening <?php tags:

ini_set ("display_errors", "1");
error_reporting(E_ALL);

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.