Jump to content

Radio Server Status Script


TomBullock

Recommended Posts

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
// [email protected]
// 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  ;D

Tom Bullock

Link to comment
https://forums.phpfreaks.com/topic/71258-radio-server-status-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.