#native_company# #native_desc#

Creating an RSS Aggregator with the PHP SimplePie Library Page 2

By W. Jason Gilmore
on August 17, 2010

Retrieving Multiple Feeds

Of course, any useful aggregator is going to be able to retrieve and simultaneously render multiple feeds. SimplePie is capable of doing not only this, but it can also merge and order the feed entries according to each feed item’s publication date!
To retrieve the feeds, all you need to do is populate an array with the various feed addresses and then pass that array to the set_feed_url() method:

$feeds = array (

To prove that the feeds are indeed being sorted according to each item’s publication date, I’ve used the $item->get_feed()->get_title() method to place the feed’s title next to each item. The results are presented in Figure 2.

SimplePie: Weaving Multiple RSS Feeds Together
Click here for larger image

Figure 2. Weaving Multiple RSS Feeds Together

Other SimplePie Features

Parsing feeds is only one of SimplePie’s many capabilities. Among other features is the ability to retrieve podcasts, send item URLs to other aggregation services such as Digg, Reddit, and Newsvine, and give users the ability to subscribe to published feeds easily. Thanks to these great array of features it really would be possible to build a solution that compares to popular tools such as Google Reader!


SimplePie provides developers with a turnkey solution for integrating RSS feed support into their Web applications. It really is simple as, well, pie.

About the Author

Jason Gilmore is the founder of WJGilmore.com and the author of
several popular books, including “Easy PHP Websites with the Zend Framework”, “Easy PayPal with PHP”, and “Beginning PHP and MySQL, Third Edition”.