Quantcast
Channel: load all items from one Atom RSS feed - Stack Overflow
Viewing all articles
Browse latest Browse all 2

load all items from one Atom RSS feed

$
0
0

I'm using SimplePie and it gives me a headache. First, let me explain what I'm trying to do.My friend, for which I'm making a website, already has blog with not so few posts and I want to load all items from there, parse them and display them if the label is correct. The problem begins when the SimplePie doesn't load the entire feed but limits to 25. According to this SO question, the default limit is 10 and I also checked the feed with Google Chrome extension where I got the entire blog content. And to clarify, the items are not cached (OK, actually they are) but are still live on the blog, so they weren't removed and I'm not getting an old content.Also, I downloaded the feed url and opened it in notepad, in there are 25 items.

Here is my example of the init() code:

 require_once("php/autoloader.php"); $feed=new SimplePie(); $feed->set_feed_url("http://jadran303.blogspot.com/feeds/posts/default"); $feed->enable_cache(false); $feed->init(); $feed->handle_content_type();

and here is my code to test the results and to see what I'm getting (this is not the production version):

$i=1;$j=1;$k=1;foreach($feed->get_items() as $item): echo$k."".$item->get_title()." - ".$item->get_date('j F Y, g:i a')."<br />"; if($category=$item->get_category()){  echo$j". ".$item->get_title()." - ".$category->get_label()." - ".$category->get_term()."<br />";  if($category->get_label()=="Peugeot 406 Coupé na terenu"){   echo" - $i ".$item->get_title()."<br />";   $i++;  }  print_r($category);  $j++; } $k++;endforeach;

My questions:

  • how to force a SimplePie to load all content from blog? Should I just "foreach($feed->get_items(0,10000) as $item):" to load everything and to be safe for a lifetime?
  • is there any other Atom parser out there more suitable for my needs? Any recommendation is most welcome.
  • why is the content sorted by label even in the default file I downloaded the label is empty, but the term has the right keywords?

Thank you for your help.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images