Web Hosting Talk







View Full Version : RSS Feed Help Needed


Serj
12-10-2004, 10:12 PM
HI all,

I am currently trying to make a rss feed from prasing a xml file with php. The XML files are on a remote computers and so i use wget to transfer them over into one centralisted server every 2 hours.

Right now the RSS feed works by everytime its called it parses the xml file and outputs rss for the users who wants it. This seems to be a wasteful process as everytime a user refreshes the rss the php praser is called and prases the large xml files.

I was wondering is there a way that for example the server can call the php parser url and the output could be saved as an .rss file and this file the users would then use to obtain the rss details etc and then next 2 hours crontab or something would call the parser.php file again and output a newly updated rss file.

I'm not a php expert and dont know alot about rss etc so hoping you know where im coming from or can help me out. Just i feel the users grabing one rss file will say on CPU compared to having to re-prase the xml file everytime the user grabs the rss php file as happens right now.

Any help is good help.

Thanks, Serj

Burhan
12-11-2004, 03:20 AM
What you can do is call the php xml-to-rss parser in the same cronjob as your wget so that when you fetch new the new xml files, you create your new rss feeds, and save them as .rss files.

You would then just need to keep track of the updated files (and delete the old ones). A database would help here. Just one table and you can track the latest file corresponding to each of your feeds. When you create a new rss feed, just update this database.

On your public end, have the links for your rss feeds come from this database.