PHP Code:
<?php
///////////////////////////////////////////
// Author: Radu Bighiu - [email]radu@webcast.ro[/email] //
///////////////////////////////////////////
//edit below
$host = "webcast.ro";
$port = "8000";
//stop editing from here
$fp=fsockopen($host,$port,&$errno,&$errstr,10);
if (!$fp) {
echo "Can't connect";
}
fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:WEBcast Mozilla - [url]www.webcast.ro\n\n[/url]");
for($i=0; $i<30; $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,$unique,$bitrate,$song) = explode(",", $fp_data);
if ($status == "0") {
echo "<center>Off Air</center>";
} else {
echo "<TABLE>";
//edit below - comment with "//" unnecessary lines
echo "<TR><TD>Current Listeners: </TD><TD>".$current."</TD></TR>";
//echo "<TR><TD>Server Status: </TD><TD>".$status."</TD></TR>";
echo "<TR><TD>Listener Peak: </TD><TD>".$peak."</TD></TR>";
echo "<TR><TD>Supported Listeners: </TD><TD>".$max."</TD></TR>";
echo "<TR><TD>Unique Listeners: </TD><TD>".$unique."</TD></TR>";
echo "<TR><TD>Stream Bitrate: </TD><TD>".$bitrate." kbps</TD></TR>";
echo "<TR><TD>Current Song: </TD><TD>".$song."</TD></TR>";
//stop editing from here
echo "</TABLE>";
}
?>
See result here:
http://radio.webcast.ro/tools/7.php