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
// 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  ;D

Tom Bullock

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.