PHP expert |
|
Je schoutcast of je shoutcast?
Deze geeft een hoop zooi weer:
<?
//Functie om gegevens van een shoutcaststream op te vragen en te weergeven.
//Gescript door Jesper Avôt | © 2004 The netXP Group.
//Demo: shoutcast("ip adres", "poort", "");
function shoutcast($adres, $poort, $only_song="") {
$stream = @fsockopen($adres,$poort,&$errno,&$errstr,10);
if(!$stream) {
echo "Stream is down!";
} else {
fputs($stream,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
for($i=0; $i<1; $i++) {
if(feof($stream))
break;
$stream_data = fread($stream,31337);
usleep(500000);
}
$stream_data = ereg_replace("^.*<body>","",$stream_data);
$stream_data = ereg_replace("</body>.*","",$stream_data);
list($current,$status,$peak,$max,$reported,$bit,$song) = explode(",", $stream_data, 7);
if($status == "1") {
$song = str_replace("- -", "-", $song);
if($only_song == "1") {
echo "<html>\n<head>\n<title></title>\n</head>\n<body>\n";
echo "Currently Playing: <a href=\"http://$adres:$poort/listen.pls\">$song</a>\r\n";
echo "</body>\n</html>";
} else {
echo "<html>\n<head>\n<title></title>\n</head>\n<body>\n";
echo "Current Listeners: $current<br>\n";
echo "Server Status: $status<br>\n";
echo "Listener Peak: $peak<br>\n";
echo "Maximum Listener: $max<br>\n";
echo "Reported Listeners: $reported<br>\n";
echo "Broadcast Bitrate: $bit<br>\n";
echo "Current Song: $song\n";
echo "</body>\n</html>";
}
} else {
echo "Geen nummer info aanwezig";
}
}
}
?>
<? //Functie om gegevens van een shoutcaststream op te vragen en te weergeven. //Gescript door Jesper Avôt | © 2004 The netXP Group. //Demo: shoutcast("ip adres", "poort", ""); function shoutcast($adres, $poort, $only_song="") { $stream = @fsockopen($adres,$poort,&$errno,&$errstr,10); if(!$stream) { } else { fputs($stream,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n"); for($i=0; $i<1; $i++) { break; $stream_data = fread($stream,31337); } list($current,$status,$peak,$max,$reported,$bit,$song) = explode(",", $stream_data, 7); if($status == "1") { if($only_song == "1") { echo "<html>\n<head>\n<title></title>\n</head>\n<body>\n"; echo "Currently Playing: <a href=\"http://$adres:$poort/listen.pls\">$song</a>\r\n"; } else { echo "<html>\n<head>\n<title></title>\n</head>\n<body>\n"; echo "Current Listeners: $current<br>\n"; echo "Server Status: $status<br>\n"; echo "Listener Peak: $peak<br>\n"; echo "Maximum Listener: $max<br>\n"; echo "Reported Listeners: $reported<br>\n"; echo "Broadcast Bitrate: $bit<br>\n"; echo "Current Song: $song\n"; } } else { echo "Geen nummer info aanwezig"; } } } ?>
Hopelijk heb je er wat aan! |