Hi everybody,

I am using PHP to create a socket to an mp3 stream. I call the PHP script in Winamp to listen to the live music. I had to add the header "Content-type: audio/mpeg"

My script works fine but the problem is that the stream is now loaded from my web server instead of my streaming server due to the socket. I am wondering if there is another method to get PHP opening a file and adding the "Content-type: audio/mpeg" header. My goal is just to get PHP opening the streaming URL, but I want the outputted stream content to be loaded from the streaming server instead of the web server.

Any help would be very welcomed!

Macsym

    Just redirect them. I know that an icy server just runs HTTP, so it should be fine. Try something like:

    header('Location: http://the.url.of/the.stream:8080');
    

      Hi Mordecai,

      Thanks for your very quick answer. I tried

      <?php
      header("Content-type: audio/mpeg");
      header('Location: http://stream.url/');
      ?>

      The player is redirected to the right URL but the header "Content-type: audio/mpeg" is not added to the output. Do you know how I could do that? I have to add other headers also.

      Thanks in advance,

      MAX

        Mordecai,

        I think your method only sends new headers to the streaming server, but I am trying to send new headers to the player. Basically, the "content-type" header should be sent with the outputted stream to the player.

        Maybe you misunderstood me.

        Cheers,

        Macsym

          Write a Reply...