Jump to content
  • 0

Help with simple php server status script?


Question

Posted

I found this code for a simple server status window online, but I can't get it to work.  I'm not very familiar with PHP, could someone take a look at it?

 

It doesn't display correctly, even after putting in my server IP.  It starts displaying all the code after "Group->Server->attributes()->loginServer ? "ONLINE" :" as text.

 

 <?php $status= simplexml_load_string(file_get_contents("http://SERVERIPHERE/?module=server&action=status-xml"));
echo "Login Server: " . ($status->Group->Server->attributes()->loginServer ? "ONLINE" : "Offline"); echo "<br>";
echo "Char Server: " . ($status->Group->Server->attributes()->charServer ? "ONLINE" : "Offline"); echo "<br>";
echo "Map Server: " . ($status->Group->Server->attributes()->mapServer ? "ONLINE" : "Offline"); echo "<br>";
echo "Players Online: " . $status->Group->Server->attributes()->playersOnline;
?>

 

2 answers to this question

Recommended Posts

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...