RSS Feeds

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
funkymeerkat
Forum Newbie
Posts: 18
Joined: Sun Jun 13, 2004 4:16 am

RSS Feeds

Post by funkymeerkat »

Hi all,

Have been looking for a while now, but not getting much sense on the web..

I need to create an rss feed. From what i can see it has to have an .rss or .xml extension??? Is that right??

Anyway, i want to populate this feed via a table in my database. I can write this php script fine however if i save the file as .rss or .xml then the php wont parse..

I have created the page with the correct rss / xml tags and embedded the php code, but i assume because the file extension is not php then that is the problem.

Is there an easy way to convert a php file to the relevant extension so this works correctly... Can someone point me in the right direction....

Thanks,
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: RSS Feeds

Post by Eran »

RSS is an XML standard for publishing. Atom is a similar standard. They are both XML, which are basically text files. It doesn't matter what the file extension is, as long as the web server understands it and the proper headers are issued.
Something like:

Code: Select all

header("Content-Type: application/rss+xml");
As long as you follow the RSS standard structure in your XML output, the browser should recognize it as such and offer options for consuming the feed.
This tutorial might be useful - http://tiffanybbrown.com/2005/12/22/dyn ... nd-apache/
Post Reply