PHP School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a PHP Expert!

Join 306,833 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,762 people online right now. Registration is fast and FREE... Join Now!




Limit PHP XML Parser (RSS)

 

Limit PHP XML Parser (RSS)

pianoguy91

4 Mar, 2009 - 08:09 AM
Post #1

New D.I.C Head
*

Joined: 3 Feb, 2009
Posts: 3

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?

User is offlineProfile CardPM
+Quote Post


JackOfAllTrades

RE: Limit PHP XML Parser (RSS)

4 Mar, 2009 - 08:24 AM
Post #2

I exist to Google your problems.
Group Icon

Joined: 23 Aug, 2008
Posts: 5,311



Thanked: 453 times
Dream Kudos: 50
Expert In: Being annoyed with lazy people.

My Contributions
Do you mean via RSS?
User is offlineProfile CardPM
+Quote Post

pianoguy91

RE: Limit PHP XML Parser (RSS)

4 Mar, 2009 - 08:27 AM
Post #3

New D.I.C Head
*

Joined: 3 Feb, 2009
Posts: 3

QUOTE(JackOfAllTrades @ 4 Mar, 2009 - 08:24 AM) *

Do you mean via RSS?


Yes. Similar to what wp_get_archives() function in Wordpress will accomplish.
User is offlineProfile CardPM
+Quote Post

JackOfAllTrades

RE: Limit PHP XML Parser (RSS)

4 Mar, 2009 - 09:55 AM
Post #4

I exist to Google your problems.
Group Icon

Joined: 23 Aug, 2008
Posts: 5,311



Thanked: 453 times
Dream Kudos: 50
Expert In: Being annoyed with lazy people.

My Contributions
I don't *think* RSS has any native, built-in way of supporting queries like get all since date. According to this, an RSS channel *may* have a lastBuildDate, which you could store and check your received data against.
User is offlineProfile CardPM
+Quote Post

AlienWebguy

RE: Limit PHP XML Parser (RSS)

4 Mar, 2009 - 04:05 PM
Post #5

D.I.C Head
**

Joined: 4 Mar, 2009
Posts: 84



Thanked: 9 times
My Contributions
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--
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/20/09 10:59PM

Live PHP Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

PHP Tutorials

Reference Sheets

PHP Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month