rendered paste body<?PHP
$bandwidthcounter = "0";
$array = array("127.0.0.1" => "80",
"127.0.0.1" => "80",
"127.0.0.1" => "80");
while(list($host, $port) = each($array)) {
// Host settings
$host = $_GET['h'];
$port = $_GET['p'];
$fp=@fsockopen($host,$port,&$errno,&$errstr,10);
if (!$fp) {
echo "unable to connect to radio";
} else {
fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
for($i=0; $i<1; $i++) {
if(feof($fp)) break;
$fp_data=fread($fp,31337);
usleep(500000);
}
$fp_data=ereg_replace("^.*<body>","",$fp_data);
$fp_data=ereg_replace("</body>.*","",$fp_data);
list($current,$status,$peak,$max,$reported,$bit,$song) = explode(",",
$fp_data, 7);
if ($status == "1") {
$online = "Currently Online";
//echo "$host:$port -> $current/$max listening to $song @ $bit kbit/s";
$bandwidth = round($bit / 8 * $current / 1024,2);
$bandwidthKB = round($bit / 8 * $current);
echo "$current/$max listening to $song and currently streaming at $bit" . "kbit - and using $bandwidthKB" . "KB/s of bandwidth";
$bandwidthcounter = $bandwidthcounter+$bandwidthKB;
} else {
$online = "Currently Offline";
echo "$online ($host:$port)";
} }
echo "<br>Server is using $bandwidthcounter KB/s of bandwidth";
}
?>