Limit PHP XML Parser (RSS)
Page 1 of 1
Limit PHP XML Parser (RSS)
#1
Posted 04 March 2009 - 08:09 AM
I am relatively new to PHP and XML, and I am interested in being able to display the titles of blog posts in widget on a website I am building. I understand how to get all of the children and their values, but not to limit them to the most recent posts. Any help or reading suggestions?
#5
Posted 04 March 2009 - 04:05 PM
Take into consideration that the XML feed is being controlled remotely and you pretty much only have to work with what they give you. That being said, you need to get the exact feed you want ahead of time (some sites let you provide feed parameters to filter out stuff you don't want or to order your feed a certain way before the data even gets to your server) or else you'll need to create a PHP script to pull the RSS feed, loop through it and insert it into a temporary database table, then use SQL to query your newly inserted data against some desired parameters and spit out exactly what you want shown. I wouldn't recommend the latter if you have a high-traffic site as you could generate some pretty significant cpu load. You could setup a cron job to pull the feed once every few minutes, or at longer intervals if the feed isn't updated very often and then only insert when you need to. You could also create a permanent table in your database called something like "cached_rss" and then check the realtime rss feed against your "cached" database-stored feed data and if there's a new feed entry, REPLACE, else just select what you have.
The idea here is that once the data is in mysql, you can pretty much do whatever you want with it.
--S--
The idea here is that once the data is in mysql, you can pretty much do whatever you want with it.
--S--
Page 1 of 1

Start a new topic
Add Reply




MultiQuote




| 


