Radio Icecast / Shoutcast PHP Proxy to Re-stream Radio Stream on HTTPS

SHOUTcast doesn’t support SSL/HTTPs. The Shoutcast service on the port like 8000 is an unencrypted server for HTTP and ICY. So Shoutcast need proxy/restream HTTP stream to HTTPS.


You can use PHP or NodeJS or NGINX to restream Radio Streams.


Re-Stream PHP Proxy file – stream/index.php



Icecast / Shoutcast MP3 Radio Stream 

Shoutcast V1 (http://shoutcast-server-ip:port/) 
Shoutcast V2 (http://shoutcast-server-ip:port/streamname) 
Icecast V2 (http://icecast-server-ip:port/streamname)

Type: Audio
Codec: MPEG Audio layer 1/2 (mpga)
Channels: Stereo
Sample rate: 44100 Hz
Bitrate: 128 kb/s


header('Content-Type: audio/mpeg');

$server = "[Server-IP-Address]";
$port = "[Port]";
$mount = "[Mount-Point]";

// HTTP Radio Stream URL with Mount Point
$url = "http://".$server.":".$port."/".$mount;

// Open Radio Stream URL
// Make Sure Radio Stream [Port] must be open / allow in this script hosting server firewall 

// Read chunks maximum number of bytes to read
if(!$f) exit;
	echo fread($f,128);  



.htaccess – stream/.htaccess

<FilesMatch "mp3$">
    SetHandler application/x-httpd-php5

RewriteEngine On
#RewriteBase /

# Redirect MP3 to PHP
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).mp3$ index.php [L]


So if you host these files on HTTPS enabled server in folder “stream” …. Radio Stream Proxy URL will look like 
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

What is difference between SHOUTcast and Icecast Streaming

Stream GB offers 3 different types of the streaming platform for audio radio streaming....