function return_xmllog() { $ms = new MasterServer(); // Update the log if necessary. $logPath = $ms->xmlLogFile(); if ($logPath !== false) { $result = file_get_contents_utf8($logPath, 'text/xml', 'utf-8'); if ($result !== false) { // Return the log to the client. header("Content-Type: text/xml; charset=utf-8"); echo mb_ereg_replace('http', 'https', $result); } } }
public function testRandomSourceServer() { $masterServer = new MasterServer(MasterServer::SOURCE_MASTER_SERVER); $serverArray = $masterServer->getServers(MasterServer::REGION_ALL, "\\type\\d\\empty\\1\\full\\1\\gamedir\\tf"); $serverAddress = $serverArray[array_rand($serverArray)]; $server = new SourceServer(new InetAddress($serverAddress[0]), $serverAddress[1]); $server->initialize(); $server->updatePlayerInfo(); $server->updateRulesInfo(); $this->assertNotNull($server->getPing()); $this->assertNotNull($server->getPlayers()); $this->assertNotNull($server->getRules()); $this->assertNotNull($server->getServerInfo()); echo $server; }
/** * Sets the number of consecutive requests that may fail, before getting * the server list is cancelled (default: 3) * * @param int $retries The number of allowed retries */ public static function setRetries($retries) { self::$retries = $retries; }