title: read mp3 stream and echo back to client in php
body: <p>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 (<code>http://127.0.0.1:8000/stream.mp3</code>), and echo the stream back to the client, from there, the client can be play it back in a basic audio tag.</p>
  
  <pre><code>&lt;?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");
  </code></pre>
  
  <p>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.</p>
  
  <p>Please note that I'm not that experienced with php.  Thanks!</p>