FOnline Development > General Discussion
Server Status checker
jan0s1k:
It's still working ::)
raynor009:
Strange, it doesn't let me connect to your site only with proxy. Maybe its blocked by isp :/
Wipe:
You can check this one, but it does not include graphic generation (yet).
raynor009:
--- Quote ---Parse error: syntax error, unexpected T_DNUMBER, expecting T_STRING or T_VARIABLE or '{' or '$' in /home2/dayzroma/public_html/FOnlineServer.php on line 45
--- End quote ---
--- Quote ---$this->Test = $name;
$this->71.113.37.17 = $host;
$this->4000 = (int)$port;
--- End quote ---
Where did I go wrong?
Wipe:
Simplest way goes like this:
--- Code: (php) ---include( 'FOnlineServer.php' );
$server = new FOnlineServer();
$server->Setup( "FOnline Server Name", "fonline.example.com", 4000 );
$server->Ping();
--- End code ---
...php does its work...
--- Code: (php) ---if( $server->Status == FOnlineServer::ONLINE )
{
echo $server->Name . ' is online, players: ' . $server->Players . ', uptime: ' . $server->Uptime;
}
else
{
echo $server->Name . ' is dead or dying';
}
--- End code ---
You can easily assume that if $server->Players is less than 0, then server is offline; be also warned, that timeout for connecting and reading data is set to very minimal values (5s for both), so you may want to increase it. Here example with 15s for connection and 30s for receiving data.
--- Code: (php) ---$server->Ping( 15, 30 );
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version