Genert Posted May 31, 2011 Share Posted May 31, 2011 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 Wheres problem? Quote Link to comment https://forums.phpfreaks.com/topic/238026-help-me-with-getting/ Share on other sites More sharing options...
Maq Posted May 31, 2011 Share Posted May 31, 2011 But it gives me just white page: http://genert.impact.pri.ee/da.php 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); Quote Link to comment https://forums.phpfreaks.com/topic/238026-help-me-with-getting/#findComment-1223121 Share on other sites More sharing options...
Genert Posted June 1, 2011 Author Share Posted June 1, 2011 I tried it,still nothing <?php ini_set ("display_errors", "1"); error_reporting(E_ALL); class Q3MasterQuery { var $error; var $result; function Q3MasterQuery($ip, $port, $prot, $keywords = '') { $servers = array(); $this->error = 0; Quote Link to comment https://forums.phpfreaks.com/topic/238026-help-me-with-getting/#findComment-1223350 Share on other sites More sharing options...
Genert Posted June 1, 2011 Author Share Posted June 1, 2011 Here is full code of it: http://genert.impact.pri.ee/da2.php Quote Link to comment https://forums.phpfreaks.com/topic/238026-help-me-with-getting/#findComment-1223372 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.