134 lines
4.0 KiB
PHP
134 lines
4.0 KiB
PHP
<?php
|
|
// Shoutcast
|
|
function getIDshout($radioip,$radioport,$postfix = "GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n") {
|
|
$open = fsockopen($radioip,$radioport,$errno,$errstr,'.5');
|
|
if ($open) {
|
|
fputs($open,$postfix);
|
|
stream_set_timeout($open,'1');
|
|
$read = fread($open,255);
|
|
$exploded = explode(",",$read);
|
|
if ($exploded[6] == '' || $exploded[6] == '</body></html>') {
|
|
$text = 'streaming'; } else { $text = $exploded[6];
|
|
}
|
|
$id = str_replace("</body></html>","",$text);
|
|
} else { return false; }
|
|
fclose($open);
|
|
return $id;
|
|
}
|
|
// Icecast
|
|
// https://stackoverflow.com/a/17109654
|
|
function getIDice($streamingUrl, $interval, $offset = 0, $headers = true) {
|
|
$needle = 'StreamTitle=';
|
|
$ua = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.110 Safari/537.36';
|
|
$opts = [
|
|
'http' => [
|
|
'method' => 'GET',
|
|
'header' => 'Icy-MetaData: 1',
|
|
'user_agent' => $ua
|
|
]
|
|
];
|
|
if (($headers = get_headers($streamingUrl)))
|
|
foreach ($headers as $h)
|
|
if (strpos(strtolower($h), 'icy-metaint') !== false && ($interval = explode(':', $h)[1]))
|
|
break;
|
|
$context = stream_context_create($opts);
|
|
if ($stream = fopen($streamingUrl, 'r', false, $context)) {
|
|
$buffer = stream_get_contents($stream, $interval, $offset);
|
|
fclose($stream);
|
|
if (strpos($buffer, $needle) !== false) {
|
|
$title = explode($needle, $buffer)[1];
|
|
return substr($title, 1, strpos($title, ';') - 2);
|
|
} else
|
|
return getMp3StreamTitle($streamingUrl, $interval, $offset + $interval, false);
|
|
} else
|
|
throw new Exception("Unable to open stream [{$streamingUrl}]");
|
|
}
|
|
|
|
// first
|
|
echo "id:;:";
|
|
try {
|
|
$firststr = getIDshout("93.100.61.75","8000"); // Anima Amoris [DubTech Mix]
|
|
if (substr($firststr, -7) == "sknt.ru") echo stristr($firststr," * anima.sknt.ru",true);
|
|
else echo $firststr;
|
|
} catch (Exception $exfirst) {
|
|
echo "unavailable";
|
|
}
|
|
// second
|
|
echo ":;:";
|
|
try {
|
|
$secondstr = getIDshout("93.100.61.75","8024"); // Anima Amoris [DubTech Mix]
|
|
if (substr($secondstr, -7) == "sknt.ru") echo stristr($secondstr," * anima.sknt.ru",true);
|
|
else echo $secondstr;
|
|
} catch (Exception $exsecond) {
|
|
echo "unavailable";
|
|
}
|
|
// third
|
|
echo ":;:";
|
|
try {
|
|
echo getIDshout("79.120.39.202","9009"); // Radio Caprice - Dub Techno
|
|
} catch (Exception $exthird) {
|
|
echo "unavailable";
|
|
}
|
|
// fourth
|
|
echo ":;:";
|
|
try {
|
|
echo getIDice("http://185.61.124.104:8066/live", 19200); // Loca FM Dub Techno
|
|
} catch (Exception $exfourth) {
|
|
echo "unavailable";
|
|
}
|
|
// fifth
|
|
echo ":;:";
|
|
try {
|
|
echo getIDshout("94.23.115.253","12005","GET /7.html?sid=1 HTTP/1.1\nUser-Agent:Mozilla\n\n"); // Chillkyway - outer space
|
|
} catch (Exception $exfifth) {
|
|
echo "unavailable";
|
|
}
|
|
// sixth
|
|
echo ":;:";
|
|
try {
|
|
echo getIDice("http://94.130.113.214:8000/dubtechno", 19200); // Schizoid Dub Techno
|
|
} catch (Exception $exsixth) {
|
|
echo "unavailable";
|
|
}
|
|
// seventh
|
|
echo ":;:";
|
|
try {
|
|
echo getIDice("http://78.47.31.164:8002/dub", 19200); // MABU Beatz Dub Techno
|
|
} catch (Exception $exseventh) {
|
|
echo "unavailable";
|
|
}
|
|
// eighth
|
|
echo ":;:";
|
|
try {
|
|
echo getIDice("http://195.133.48.93:8000/MixCult_96kbps", 19200); // MixCult Deep Techno Radio
|
|
} catch (Exception $exseighth) {
|
|
echo "unavailable";
|
|
}
|
|
// ninth
|
|
echo ":;:";
|
|
try {
|
|
echo getIDshout("198.24.145.146","8852"); // Deep Planet on MixLive.ie
|
|
} catch (Exception $exninth) {
|
|
echo "unavailable";
|
|
}
|
|
// tenth
|
|
echo ":;:";
|
|
try {
|
|
echo getIDice("http://node-31.zeno.fm/0aapuzcxc5zuv", 19200); // Coldfunk
|
|
} catch (Exception $extenth) {
|
|
echo "unavailable";
|
|
}
|
|
// eleventh
|
|
echo ":;:";
|
|
try {
|
|
echo getIDice("http://176.31.107.8:8133/stream", 19200); // arctic dub (sursumcorda)
|
|
} catch (Exception $exeleventh) {
|
|
echo "unavailable";
|
|
}
|
|
// twelfth
|
|
echo ":;:";
|
|
echo "unavailable [commercial]"; // Digitally Imported Dub Techno
|
|
echo ":;:";
|
|
|
|
?>
|