Stream MP3 using PHP – m3u

On April 11, 2010, in Fedora, Linux, PHP, Tips, Tricks, Web Services, by admin

M3U is a computer file format that stores multimedia playlists.


function m3u_stream($dir) {


$h1 = opendir($dir);

while ($file = readdir($h1))

if ($file == ‘.’ || $file == ‘..’) continue;



return $mp3;


$folder = “phpsolutions”;

file_put_contents($folder.”.m3u”, m3u_stream($_SERVER[“DOCUMENT_ROOT”].”/mp3/”.$folder.”/”));


Here “phpsolutions” is a folder where all mp3 files exists… this program will create phpsolutions.m3u playlist file using php script.

phpsolutions.m3u file contents all mp3 links with domain “”



Now can be used for streaming mp3 from

8 Responses to Stream MP3 using PHP – m3u

  1. Anonymous says:

    I’m really thankful towards author with this post to create this lovely and informative article live here for us. We really appreciate ur effort. Carry on the nice work. . . .

  2. Anonymous says:

    I seriously loved this post. You describe this topic adequately. When hiring home contractors it really is step to pick a trusted name in construction. Experienced and efficient staff should strive for excellence and absorb every detail of your dwelling.

  3. Anonymous says:

    Wow, that’s an incredibly nice read!

  4. Anonymous says:

    To be sure together with your thoughts here and i also like your website! I’ve bookmarked it to ensure I could revisit & read more down the road.

  5. Anonymous says:

    I am really thankful towards the author on this post for making this lovely and informative article live here for us. We really appreciate ur effort. Carry on the good work. . . .

  6. Anonymous says:

    Hey very cool blog!! Man .. Beautiful .. Amazing .. I will bookmark your website and take the feeds also…I’m happy to find a lot of useful info here in the post, we need develop more techniques in this regard, thanks for sharing. . . . . .

  7. Anonymous says:

    thanks a lot your posts very important and easy to understanding it i know that beacuse i am working in accounting office in egypt and i translate my experiance to french language

  8. Deanna Strzyzewski says:

    Greetings from Colorado! I’m bored to tears at work so I decided to browse your website on my iphone during lunch break. I really like the knowledge you present here and can’t wait to take a look when I get home. I’m shocked at how quick your blog loaded on my mobile .. I’m not even using WIFI, just 3G .. Anyways, superb site!

Leave a Reply