Using PHP to update RSS

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
ayfine
Forum Newbie
Posts: 22
Joined: Mon Nov 27, 2006 4:52 pm

Using PHP to update RSS

Post by ayfine »

I am completely new to RSS and I haven't found any places that explain how to update an RSS feed with php.

I have my ideas about how to do it, mainly doing something like

Code: Select all

header('Content-Type: text/xml');
And then using mysql queries to grab information. Is this the right way to go about doing this?

edit

I went ahead and tried this and when I was declaring the xml version, because the tags end in ?> it gave an error.
Rovas
Forum Contributor
Posts: 272
Joined: Mon Aug 21, 2006 7:09 am
Location: Romania

Post by Rovas »

You attach a timestamp to the RSS code using

Code: Select all

date()
  mktime()
Also read the php function that deal with XML
EDIT
Use XPath to search the xml document for the time :

Code: Select all

<lastBuildDate>
and then delete that news item :)
User avatar
idevlin
Forum Commoner
Posts: 78
Joined: Tue Jun 26, 2007 1:10 pm
Location: Cambridge, UK

Post by idevlin »

Hmmm, I just opened the file, and added the new details to it and closed it again.

Can't use the fancy XML parsing stuff that comes with PHP5 as my host still has PHP4. Ho hum.
Post Reply