12
Nov

SimplePie RSS Feed library

   Posted by: admin   in PHP, Software Development

SimplePie is a PHP development library for reading RSS. It’s amazingly simple, well documented and full featured. I have written 4 RSS readers for portals and virtual desktops using it, and it’s alsways been a pleasure to work with. Here is the link:

http://simplepie.org/

When would you use this? Anytime you want to pull an RSS feed into a page for a decision or display. Almost everything has an RSS feed. You can pull in multiple feeds, have them automatically cached and aggregated, and choose a sort method. It will also automatically find RSS feed URLs if you give it a URL to any site. Combine this with something like Dapper: http://www.dapper.net/ and there’s no limit to what you can integrate into your project!

Here’s some sample code to show how easy SimplePie is:

<?php
require_once(‘SimplePie/simplepie.inc’);

$feed = new SimplePie(array(‘http://suddendevelopment.com/?feed=rss2′,‘http://LegalizeThought.com/?feed=rss2′));
$feed->handle_content_type();

$htmlOut = ;
//====|| Get RSS items for feed||====\\
foreach ($feed->get_items() as $item){
$htmlOut .= ‘<div class="rssItem">’;
$htmlOut .=    ‘<div class="rssTitle"><a href="’.$item->get_permalink().‘">’.$item->get_title().‘</a></div>’;
$htmlOut .=    ‘<span class="rssDescription">’.$item->get_description().‘<br></span>’;
$htmlOut .=    ‘<span class="rssDate">’.$item->get_date(‘j F Y | g:i a’).‘</span>’;
$htmlOut .= ‘</div>’;
}
print $htmlOut;

?>
 

Share and Enjoy:
  • Digg
  • Technorati
  • Google Bookmarks
  • del.icio.us
  • Facebook
  • StumbleUpon
This entry was posted on Wednesday, November 12th, 2008 at 8:48 am and is filed under PHP, Software Development. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a reply

Name (*)
Mail (will not be published) (*)
URI
Comment