1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| <?php
// Edit the next two lines with your server information
$host = "IP";
$port = "PORT";
// Connect to server
$fp=@fsockopen($host,$port,&$errno,&$errstr,10);
if (!$fp) {
echo "Unable to connect to server";
} else {
// Get data from server
fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
// exit if connection broken
for($i=0; $i<1; $i++) {
if(feof($fp)) break;
$fp_data=fread($fp,31337);
usleep(500000);
}
// Strip useless junk from source data
$fp_data=ereg_replace("^.*<body>","",$fp_data);
$fp_data=ereg_replace("</body>.*","",$fp_data);
// Place values from source into variable names
list($current,$status,$peak,$max,$reported,$bit,$song) = explode(",", $fp_data, 7);
if ($status == "1") {
// To use any of the outputs below just uncomment (remove the double forward slashes) that line.
// Below is an example of all data available in the 7.html file made by the Shoutcast server
// **ON BY DEFAULT - COMMENT OUT (put to forwards slashes in front of it) TO HIDE
echo "<html>\n<head>\n<title></title>\n</head>\n<body>\nCurrent Listeners: $current<br>\nServer Status: $status<br>\nMaximum Listener: $max<br>\nBroadcast Bitrate: $bit<br>$genre<br>$puplic\nCurrent Song: $song\n<br><br><a href=\"java script:location.reload()\"><b>Cliquez ici pour actualiser les
informations</b></a></body>\n</html>";
// Below is a basic one line value of the current song, perfect for front pages of sites
//echo "<html>\n<head>\n<title></title>\n</head>\n<body>\nCurrently Playing: <a href=\"http://$host:$port/listen.pls\">$song</a>\r\n</body>\n</html>";
} else {
echo "The radio station is currently down";
} }
?> |
Partager