PHP Get Radio Stream Type Version

Live Audio Streaming, Internet Radio Player

Shoutcast1 Stream: http://shoutcast-server:port/;audio.mp3
Shoutcast2 Stream: http://shoutcast-server:port/streamname;audio.mp3
Icecast2 Stream: http://icecast-server:port/streamname

Shoutcast server stream need “;” OR “;audio.mp3” at end of stream URL, so change accordingly

 

<?php

function radioStreamType($stream)
{

$pp = parse_url($stream);
$type = strstr($pp[‘path’], ‘;audio.mp3’);

if($type==’;audio.mp3′)
{
if($pp[‘path’]==”/;audio.mp3″ || $pp[‘path’]==”;audio.mp3″) return “shoutcast1”;
return “shoutcast2”;
}
else
{
return “icecast”;
}
}

?>

 

shoutcast-version-1

radioStreamType(“http://shoutcast-server:port/;audio.mp3”);

shoutcast-version-2

radioStreamType(“http://shoutcast-server:port/streamname;audio.mp3”);

icecast

radioStreamType(“http://icecast-server:port/streamname”);

ICECAST SHOUTCAST METADATA