NickolasM.
12-06-2008, 02:08 AM
I want this to show a link when the radio is online, I can not get it to work help?
<?php
$server = "{IP HERE, Took out for my reasons}"; // IP address to your shoutcast server.
$port = "8010"; // port of your shoutcast server
$online = "../../Images/Stats/On Air/On Air.gif"; // Online Gif image
$offline = "../../Images/Stats/Off Air/Off Air.gif"; // 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");
echo '<p><a href="Http://www.google.com"> Listen Live</p></a>';
}
?>
<?php
$server = "{IP HERE, Took out for my reasons}"; // IP address to your shoutcast server.
$port = "8010"; // port of your shoutcast server
$online = "../../Images/Stats/On Air/On Air.gif"; // Online Gif image
$offline = "../../Images/Stats/Off Air/Off Air.gif"; // 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");
echo '<p><a href="Http://www.google.com"> Listen Live</p></a>';
}
?>