This is probably the easiest way to read RSS feed in PHP, you use simplexml_load_file. It returns a SimpleXMLElement object. The snippet below grabs my blog’s feed and outputs in SimpleXMLElement assigned to the variable $blog. The rest is rather self explanatory.

[code lang=“php”]$blog = simplexml_load_file(",





$posts = array();

foreach ($blog->channel->item as $item) {

array_push($posts, $item);



The problem with SimpleXML is that it ignores CDATA by default. To stop that from happening, you could merge CDATA as text nodes by specifying the option constant LIBXML_NOCDATA.

comments powered by Disqus