Read Rss/Atom feed using php

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

  $feed = new SimplePie();
  $SiteTitle= $feed->get_title();
  foreach($items as $item)
  if ($category = $item->get_category())
  $CatName = $category->get_label();

Demo Download

Liked It? Get Free updates in your Email

Delivered by feedburner

Leave a Reply

Your email address will not be published. Required fields are marked *