Want an easy way to generate a podcast or RSS feed? At Eliot’s request, I wrote a PHP script that generates an RSS feed based on the contents of its parent directory, so whenever you add files to that directory (or its subdirectories), the feed is updated with links to those files. It also supports enclosures, so if you add an audio or video file to the directory, that file will be available to podcast clients. If you modify a file in the directory, the feed updates the link so that subscribers will see that it has changed. It’s a no-fuss way to syndicate content without having to tie it into a CMS like WordPress or TypePad.
Here’s how to use it:
- Save this file as EasyFeed.php (or dir.php or feed.php, it doesn’t really matter).
- Copy it to a directory on your webserver.
- Subscribe to the feed with any RSS or podcasting client.
That’s all there is to it. For example, here’s the feed of all of the files I’ve ever uploaded for use in my blog. If you subscribe to that feed with iTunes, you’ll see that I’ve uploaded two audio files: programming.mp3 and calacanis.mp3. iTunes will automatically download them, as well as any other audio/video files I upload. No fuss, no muss.
6 comments on “Easy-peasy podcasting”
Thanks for the script. I just love running across little gems like this.
Nice script. I will find a good use for it. One question though.
(I am wanting to drop some php redirect files in the directory so I can create a custom feed for the content that I choose.)
Let’s say I wanted the title to read “Chris Finke Rocks”, but my file is actually “Chris_Finke_Rocks.php”. How hard would it be to remove the “_” and replace it with a space, and also remove the .php extension? So basically, I want to create a title based on the filename but retain the correct url to the file.
Softsled: you could replace this line:
echo htmlentities(str_replace(“_”,” “,strrev(array_pop(explode(“.”, strrev($file), 2)))));
(Haven’t tested that, but it should work. There are other ways as well, but this once came to mind first.)
This is the first script I’ve been able to get working on our poor beatup server. Any chance you could tell me how to read ID3 tags or some way to add a description/title for each file? I’d like to make it simple enough that our intern can update this stuff via web form…
We are programing group form poland.
gives me internel server error…