Usage: http://www.lfsworld.net/hoststatus/?h={your server name} .
Example:
http://www.lfsworld.net/hoststatus/?h=[TC]%20CityDriving%20One . You can get it in PHP file with this code:
<?php
function GetInformation($name, $output)
{
if ($name == "Players")
{
$output = explode('<div id="Users" class="DataCont"><div class="Field3">', $output);
$output = str_replace('</a>', '', $output[1]);
$output = preg_replace('/<a class="User" href="(.*?)" target="_blank">/i', '$2', $output);
}
else
{
$output = explode('<div id="'.$name.'" class="DataCont">', $output);
$output = explode('</div>', $output[1]);
$output = str_replace('<div class="Field2">', '', $output[1]);
}
return $output;
}
//Variables
$info = array("Track" => "", "Cars" => "", "Version" => "", "Conns" => "", "Players" => "");
$hostname = "[TC]%20CityDriving%20One"; //Change to your server hostname
$time_start = microtime(true);
// Get contents from website url
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.lfsworld.net/hoststatus/?h=".$hostname);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
// Set contents into array
foreach ($info as $name => &$value)
{
$info[$name] = GetInformation($name, $output);
}
// Show information from array
echo "<pre>";
print_r($info);
echo "</pre>";
//Script execution time
$time_end = microtime(true);
$time = $time_end - $time_start;
echo "Script executed in ".$time." seconds";
?>