What I intend to achieve, is a page that when a client is to connect, the page is to constantly read from a local ice-cast server (http://127.0.0.1:8000/stream.mp3
), and echo the stream back to the client, from there, the client can be play it back in a basic audio tag.
<?php
header("Content-Transfer-Encoding: binary");
header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
header('Content-Disposition: attachment; filename="stream.mp3"');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
print file_get_contents("http://127.0.0.1:443/stream.mp3");
With this code it only eats up ram and returns nothing useful to the client, I'm thinking something along the lines of waiting until a megabyte buffer is full, then echoing it to the client. But idk, so yeah.
Please note that I'm not that experienced with php. Thanks!