I am trying to embed the following code:
Chaos Worlds Server Status:
<?php
// Set up server connection variables
$ip = "70.181.149.105";
$port = 7234;
// Attempt to establish a connection
$sock = @fsockopen($ip, $port, $errnum, $error, 5);
if (!$sock) {
//If it fails $real (stands for REALtime server status) is set to "OFFLINE" in red.
$real = '<B><FONT COLOR=red>OFFLINE</b></FONT>';
} else {
// If connection is a success then do this
// You may need to uncomment the following line if it doesn't seem to be working.
//stream_set_timeout($sock, 2);
// Set $real to "ONLINE" in green.
$real = '<B><FONT COLOR=lime>ONLINE</b></FONT>';
// Add the text "Players Currently Online: " to the next line down
$real .= "<br>Players Currently Online: ";
// Send "top" to the server
fwrite($sock, "top");
// Read what the server sent back and convert it to an integer variable
// and then add it to the $real variable
$real .= (int)trim(fread($sock, 2));
}
echo $real;
?>