Embed a Server Status on your site
Adding a server status to your site, using the page I provided, is pretty simple. Just add an iframe to your page widget using this code:
The frame height is set to only contain the "Server Status" and "Up" or "Down". Any additional text from a notice will make the window scrollable.<div align="center">
<iframe src="http://motty.000space.com/champions/status.php?css=co.css" allowtransparency="true" align="top" scrolling="auto" frameborder="0" height="50" width="160"></iframe>
</div>
I've also included a way to choose several other stylesheets or add to add your own. The default stylesheet uses images on a dark background.
To make your own stylesheet, follow this basic template (this is the default CSS)
Then name the file something like "co.css", upload it to your server and finally, point the iframe src css variable to the file:/* Overall page */
body {
background-color: #222;
margin: 0 auto;
font-family: Verdana, Helvetica, sans-serif;
color: #ddd;
text-align: center;
}
/* wraps contents */
.wrapper {
color: #ddd;
width: 130px;
padding: 5px;
text-align: center;
margin: 0 auto;
overflow-x: hidden;
}
/* Server Status text */
.serverStatus .text {
color: #ddd;
background: url(server-status.png) no-repeat;
text-align: center;
text-indent: -9999em; /* hide text if using images */
margin: 0 auto;
height: 20px;
width: 120px;
}
/* Server Status Up or Down */
.statusUp {
color: #ddd;
background: url(server-up.png) no-repeat;
text-align: center;
text-indent: -9999em; /* hide text if using images */
margin: 0 auto;
height: 20px;
width: 40px;
}
.statusDown {
color: #ddd;
background: url(server-down.png) no-repeat;
text-align: center;
text-indent: -9999em; /* hide text if using images */
margin: 0 auto;
height: 20px;
width: 75px;
}
.notice {
color: #ddd;
font-weight: bold;
}
Add Your Own Server Statushttp://motty.000space.com/champions/status.php?css=http://mysite.com/co.css
This method shows you how to add your own server status using php and XML RPC (you'll need this extension installed on your server). I barely know php and I don't know XML RPC at all, so piecing this code together took some work and help from Diamonds who works at Cryptic. I'm just posting the result of that work and to hopefully keep Diamonds from being barraged with more questions about setting up a server status.
Check your phpinfo() and make sure you have the XMLRPC enabled
Here is the basic php required to obtain the server status:
# Using the XML-RPC extension to format the XML package
$request = xmlrpc_encode_request( "wgsLauncher.getServerStatus", $srvr );
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
curl_setopt($ch, CURLOPT_URL, "http://www.champions-online.com/xmlrpc.php");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 1);
$result = curl_exec($ch);
curl_close($ch);
$method = null;
$params = xmlrpc_decode_request($result, &$method);
# server status result = true (up) or false (down)
$status = ($params['status']) ? 'Up' : 'Down';
$notice = ($params['notice'] == "") ? "" : "Notice: " + $params['notice'];