We're now over here at Pocono'd
https://ready.audio/assets/img/poconod-facebook.png 2020-05-11 00:00:01 https://ready.audio/show/poconod

Dynamic M3U playlist with PHP and MySQL http://www.croncast.com/resized-images/none.jpg   Released: 2007-01-01 20:20:23 http://www.croncast.com/article/599/Dynamic-M3U-playlist-with-PHP-and-MySQL/

Podcasters listen up. I wanted to create a playlist (M3U file) in a couple varieties, one: recent podcasts (the last 30) and two: all podcasts. You would think this would be a simple thing to do with PHP and MySQL . . . nope. WordPress users might find this handy.

I did succeed (recent playlist).

Here's how I got it done:

1) Add a mod_rewrite line to your .htaccess file that ends with '.m3u' like so:

RewriteRule ^playlist/all/playlist.m3u$ http://www.yourdomain.com/yourscript.php?type=$1
2) Create the PHP script to generate the M3U data structure:
a. connect to your MySQL database
b. query your live podcasts (the ones in your cms like WordPress not labled draft. You'll most likely need to know the data type it submits to this field in the database like '0' or '1')
c. pull up the post id, post title and podcast file
3) Lie to the browser by writing a header for an M3U file:
header("content-type: audio/x-mpegurl");
4) Write this line without 'echo' or 'print':
5) Create a loop to write your podcast id, podcast title and podcast URL

6) The M3U output, which you shouldn't see in the browser if you do this right (I know I saw it for about an hour) looks like:
#EXTINF:597,Betsy and her husband Kris Jan 01, 2007
#EXTINF:596,Betsy and her husband Kris Dec 29, 2006
I am not a super coder but this should be enough to get you going. And just in case that it isn't look below for the exact (well, nearly exact script that I am using).

dynamic m3u m3u php m3u from php m3u php mysql dynamic m3u from php

Follow with...
Recent Episodes This is new, Brooklyn to where?, Safety first http://www.croncast.com/resized-images/WKOEBbccQIPdKx.jpg http://www.croncast.com/article/5487/This-is-new-Brooklyn-to-where-Safety-first/ Foot Powered, Construction Worker Shampoo, Trashy Blues http://www.croncast.com/resized-images/Fwvbpl5nJBXAR9.jpg http://www.croncast.com/article/5486/Foot-Powered-Construction-Worker-Shampoo-Trashy-Blues/ Life Coaches, Prey Birds, Generation Lazy http://www.croncast.com/resized-images/1Jd0lurJevipSu.jpg http://www.croncast.com/article/5485/Life-Coaches-Prey-Birds-Generation-Lazy/ Faces, App Ideas, Gotta Chill http://www.croncast.com/resized-images/Q257Cv6PwmFXpS.jpg http://www.croncast.com/article/5484/Faces-App-Ideas-Gotta-Chill/ Stellar Vibes, Flipping, Big Tickets http://www.croncast.com/resized-images/CXKhMN3gQGgeDk.jpg http://www.croncast.com/article/5483/Stellar-Vibes-Flipping-Big-Tickets/ With Strangers, Dirty Dirty, Resale Glory http://www.croncast.com/resized-images/0fOEYWoJ8jALPY.jpg http://www.croncast.com/article/5482/With-Strangers-Dirty-Dirty-Resale-Glory/ Vegas Inn, Patched Soul, Room and Board http://www.croncast.com/resized-images/Yl2zBf0k0vbLoo.jpg http://www.croncast.com/article/5481/Vegas-Inn-Patched-Soul-Room-and-Board/ Uber This, The Store, Never Tug http://www.croncast.com/resized-images/1Mvk7m7jtQuekU.jpg http://www.croncast.com/article/5480/Uber-This-The-Store-Never-Tug/ Janice Jokes, That Stone, Types http://www.croncast.com/resized-images/Z8rRQz7sT85n8a.jpg http://www.croncast.com/article/5479/Janice-Jokes-That-Stone-Types/ Cold in The Hook, Hanging With Pauly, Life is Weird http://www.croncast.com/resized-images/0L8NFMCvVcgY3C.jpg http://www.croncast.com/article/5478/Cold-in-The-Hook-Hanging-With-Pauly-Life-is-Weird/ Fruit of the Tree, Branded Thanksgiving, ITYS http://www.croncast.com/resized-images/7DyPqXSIYpAbEm.jpg http://www.croncast.com/article/5477/Fruit-of-the-Tree-Branded-Thanksgiving-ITYS/
Listen with Home Episodes About Contact Website contents: Episodes, Text and Graphics are © Copyright 2004-2020 Palegroove Studios unless otherwise noted.