• i believe in what i do •

June 2013 Archives

Read Rss/Atom feed using php without allow_url_fopen

| 0 Comments | 0 TrackBacks

Web feed is a data format used to provide updates for blog or website. Most common types of feed are Rss and Atom. In this article you will learn how to read these feeds using php.

As we know that feeds are generated by using XML, so generic way to parse it by using php5 simplexml_load_file function. But we have to write different functions to parse different types of feed and versions. 
To do this in simple way there is a php class named SimplePie

Php code to read Rss/Atom feed using SimplePie
  $SiteTitle= $feed->get_title();
  foreach($items as $item)
  if ($category = $item->get_category())
  $CatName = $category->get_label();