Read WordPress RSS Feeds, YouTube Video Lists, and more…

Posted on Apr 16, 2008 in PHP | 1 comment

I needed to grab a couple of new blog entries on a website’s wordpress blog area, and put it on a non-wordpress home page. I ended up making a PHP 5 class that did the job for me. Very simple, no fancy stuff.

I then needed to get a load of youtube video posts on the same site from a specific account and had to make a list of that, with thumbnails etc. . I ended up tweaking the first class ever so slightly and lucky me, I had an easy feed reader.

This class has some limitations, this is because it does what I need it to do:

  • You only get the items specified. In the case of wordpress RSS, you’d only get all the <item></item> elements for easy reading.
  • Only first child values are used. If an element within the elements you searched for has children, you won’t have easy reading of their values.
  • Attributes are not available for easy reading.

There is a simple workaround for these limitations, which is by using the DOMDocument object stored in the ReadFeed object. You can access it via $ReadFeedObj->dom->etc…

This class needs php 5 and will not work with earlier versions

I have added some documentation which you can find here, along with the source code.

Here is a simple example for getting your wordpress posts:

$feed = new ReadFeed(“”, “item”);
foreach ($feed->items as $item){


description ?>