TomBullock Posted September 30, 2007 Share Posted September 30, 2007 Hello I have this script, and it tells you the status of the server you have entered. For this one though, it wants you a 'Online' image and a 'Offline' image. I dont want this thought, i simply want it so when the radio is online it says 'Online' in green, and when it is offline i want it saying 'Offline' in red. Im usless at php and i will end up destroying the script if i tried to change it :-\ Heres the script: <?php // Mysql staus image script by Anthony Parkes // anthony@aj-services.com // www.aj-services.com $server = "xx.xxx.xxx.xxx"; // IP address to your shoutcast server. $port = "xxxx"; // port of your shoutcast server $online = "images/online.png"; // Online Gif image $offline = "images/offline.png"; // offline gif image // Start Data Collection $fp = fsockopen("$server", $port, $errno, $errstr, 30); fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); while (!feof($fp)) { $content .= fgets($fp,128); } fclose($fp); // start data processing $debut = strpos($content, '<body>') + strlen('<body>'); $fin = strpos($content, '</body>', $debut); $string = substr($content, $debut, $fin - $debut); $stats = explode(',', $string); // Start Image generation // Dedug Status echo "$stats[1]"; //offline if ($stats[1] == "0" || !$stats) { header("Location: $offline"); } //online if ($stats[1] == "1") { header("Location: $online"); } ?> Thanks for any help Tom Bullock Quote Link to comment https://forums.phpfreaks.com/topic/71258-radio-server-status-script/ Share on other sites More sharing options...
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.