I had to take a slightly round-the-ass approach which worked for me. I'll try your suggestion soon --
public function __construct($addr = '52.6.51.142', $port = 27015)
{
try {
$this->server = new SourceServer($addr, $port);
$this->info = $this->server->getServerInfo();
$this->id = $this->info['serverId'];
} catch (SteamCondenserException $e) {}
}
public function getAllServers()
{
if(!$servers = Cache::get('allservers'))
{
$servers = $this->server->getMaster()->getServers(MasterServer::REGION_ALL,'\appid\346110', true);
Cache::put('allservers', $servers, 10);
}
return Cache::get('allservers');
}
But, now the issue is that when I try to query individual servers, they don't all respond within even a 5 or 10 second timeout. I can't seem to catch the error so the code will continue??
public function nameAllServers()
{
if($servers = Cache::get('allservers'))
{
$namedservers = [];
foreach($servers as $server)
{
$mstr = new SourceServer($server[0], $server[1]);
$mstr->initialize();
try
{
$info = $mstr->getServerInfo();
echo $info['serverName'].'<br>';
array_push($namedservers, [
'ip' => $server[0],
'port' => $server[1],
'id' => $info['serverId'],
'name' => $info['serverName']
]);
}
catch(TimeoutException $e) {}
catch(SteamCondenserException $e) {}
}
Cache::put('namedservers', $namedservers, 15);
return Cache::get('namedservers');
}
return $this->getAllServers();
}
Always throws the exception. I've even tried error_reporting(0); Sorry it's so disorganized right now. Just largely playing around and learning-- planning to cycle the updates in small batches with refactoring
Thanks,
Zak