MySQL, PHP, and Podcasting
Part 1: The Introduction
Now, there is an RSS tutorial already in PHP: Main, but this is alot different. You see, I don't like the idea of having an XML page be in PHP. I figure
that it should be a static page.
I started a Podcast a little while ago, just to see how it would be. It's pretty cool, I must say, just to say that you have a Podcast. I've been trying
for quite a while now to figure out a good way to make it dynamic, without it being a .php file. That's when I tried working with the file
functions. I've decided that I love them, and that they are the best way to do it.
To start, I'd like to say that my host does not currently support PHP 5, so you may notice some of my code to be a little...outdated. For instance, I
and fclose(), instead of just calling to file_put_contents(), as that last function is not supported by PHP 4.
Alright, let's begin, shall we?
Part 2: Podcasting, Generally Speaking
Just a quick overview of what Podcasting is, in case you didn't know. Podcasting is accessable through iTunes. It's a place to get free music and movies
from other people. For instance, Homestarrunner.com has a Podcast, and so does Happy Tree Friends. They have mp4's of their cartoons you can download,
made specifically for your iPod. I on the other hand have an audio Podcast, which can be used on your iPod or just in iTunes.
Podcasting goes through an XML file. Some of the tags are iTunes specific, but it will be obvious which ones. I'll be giving you all the code you need to
create one.
Part 3: In The Beginning...
First off, let's create the files, just for kicks and giggles.
Number one, create a file named "podcast.xml", or named different if you want. I'll be using that filename for all intents and purposes. CHMOD it to 777.
Number two, create a file named "podcast.php", preferrably in a directory protected by HTACCESS below the directory that contains "podcast.xml".
Number three, create a file named "podcasting.php", in the same directory as "podcast.php".
Now, create the MySQL database. For this tutorial, I'll use the database name "user_site" and the username "pod_caster". If you don't know how to set up
the database...well, I'll let you figure that one out on your own.
The table name in this tut is going to be "site_podcast". You'll want to create yours and give it 8 fields. The first is "id"; make it key, make it INT,
and make it auto-increment. The rest are just going to be text - "title", "author", "subtitle", "summary", "url", "date", and "duration".
Kay, let's get coding.
Part 4: Throwing It Out
Open up your "podcast.php" for editing. Now, just so you know, this doesn't have to be a PHP page, but I have a few includes in mine, so I made it that
way. Oh, and this is my tutorial, so I can do whatever I want.
Now, I'm just gonna give the form code, nothing else. Very bare-bones and customisable.
podcast.php
<form action="podcasting.php" method="post">
Title: <input type="text" name="title" size="20" />
<br />
Author: <input type="text" name="author" size="20" />
<br />
Summary: <input type="text" name="summary" size="20" />
<br />
Subtitle: <input type="text" name="subtitle" size="20" />
<br />
URL: <input type="text" name="url" size="20" />
<br />
Duration (in X:XX format): <input type="text" name="duration" size="20" />
<br />
<input type="submit" value="Submit" />
</form>