[php]
ServUO [1] => Name=My Shard [2] => Age=3 [3] => Clients=1 [4] => Items=112187 [5] => Chars=2934 [6] => Mem=217514K [7] => Ver=2 )
RunUO and Sphere Shards don’t return version:
Array ( [0] => ServUO [1] => Name=My Shard [2] => Age=3 [3] => Clients=1 [4] => Items=112187 [5] => Chars=2934 [6] => Mem=217514K )
2016 – Ixtabay for www.RunUO.com
*/
$shard_addr =”localhost”;
$shard_port =”2593″;
$fp = fsockopen($shard_addr, $shard_port);
if (!$fp) {
echo “
Server is getting updates, please be patient…
“;
} else {
fwrite($fp, “\x7f\x00\x00\x01\xf1\x00\x04\xff”);
stream_set_timeout($fp, 2);
$res = fread($fp, 2000);
$info = stream_get_meta_data($fp);
fclose($fp);
if ($info[‘timed_out’]) {
echo “
Server is getting updates, please be patient…
“;
} else {
$ver = ”;
$arr = explode(‘,’, $res);
$emu = $arr[0];
$name = ltrim(strstr($arr[1],’=’), ‘=’);
$age = ltrim(strstr($arr[2], ‘=’), ‘=’);
$clients = ltrim(strstr($arr[3], ‘=’), ‘=’);
$items = ltrim(strstr($arr[4], ‘=’), ‘=’);
$mobs = ltrim(strstr($arr[5], ‘=’), ‘=’);
$mem = ltrim(strstr($arr[6], ‘=’), ‘=’);
if ($emu <> “ServUO”) $ver = “Unknown”; // Only ServUO Shards return version
else $ver = ltrim(strstr($arr[7], ‘=’), ‘=’);
// Output the status information with some basic styling and formatting [/php]
echo <<
Status:
Online
Emulator:
$emu
Shard Name