Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
/*
**
** author: Johannes Distler
**
** grep shoutcast informations, without
** processing its XML output. streaminfo()
** delivers connected users, max users,
** user peak, bitrate and current played song.
**
** $file = shoutcasts ip/domain
** $port = shoutcasts listen port
** usage: streaminfo("seth4you-radio.de",8010);
**
** have phun!
**
**************************************************
*************************************************/
function streaminfo($file,$port) {
$fp = @fsockopen ($file, $port, &$errno, &$errstr, 5);
if (!$fp) {
echo "Could not connect to <b>{$file}:{$port}</b> ({$errno}) - {$errstr}\n";
} else {
fputs ($fp, "GET /7 HTTP/1.1\r\nUser-Agent:Mozilla\r\n\r\n");
while (!feof($fp)) {
$stream = fgets($fp,1024);
}
list(,$stream) = explode("<body>",$stream);
list($stream) = explode("</body>",$stream);
list($user, $status, $user_peak, $user_max, ,$bitrate, $song) = explode(",",$stream);
if($status=="0") {
echo "<b>{$file}:{$port}</b> is offline!";
} else {
echo "<b>{$file}:{$port} on air!</b><br><br>
<b>user still connected:</b> {$user} of {$user_max}<br>
<b>user peak:</b> {$user_peak}<br>
<b>bitrate:</b> {$bitrate} kbits/s<br>
<b>current song:</b> {$song}<br>";
}
fclose($fp);
}
}