Jump to content

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);

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.