Jump to content

Recommended Posts

Posted (edited)

I noticed that FluxCP has XML version of the server status. I would like to share how to easily customize your online status. We are going to use SimpleXMLElement Class in php.

//Specify what is the URL of the status-xml
$url = "http://www.yourdomain.com/FluxCP/index.php?module=server&action=status-xml";

//Get the content of the status xml using file_get_contents function
$statusxmlcontent = file_get_contents($url);

//Load the content to the SimpleXMLElement class so it will be in array form
$statusxmlarray = new SimpleXMLElement($statusxmlcontent );

//You can use var_dump($statusxmlarray); to see the structure of the array

//Getting the Map Server Status
//$statusxmlarray->Group->Server['mapServer']

if($statusxmlarray->Group->Server['mapServer'] == 0)
  echo  "Map Svr is Offline";
else
  echo "Map Svr is Online";


//Getting the Character Server Status
//$statusxmlarray->Group->Server['charServer']

if($statusxmlarray->Group->Server['charServer'] == 0)
  echo  "Char Svr is Offline";
else
  echo "Char Svr is Online";



//Getting the Login Server Status
//$statusxmlarray->Group->Server['loginServer']

if($statusxmlarray->Group->Server['loginServer'] == 0)
  echo  "Login Svr is Offline";
else
  echo "Login Svr is Online";


//Getting the Online Users
//$statusxmlarray->Group->Server['playersOnline']

echo "Users Online : ".$statusxmlarray->Group->Server['playersOnline'];

Edited by JayPeeMateo
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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