JayPee Posted December 22, 2011 Posted December 22, 2011 (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 December 22, 2011 by JayPeeMateo 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.