Are there any free php/javascript libraries out there which would help in displaying an RSS feed as html?
+4
A:
Maybe SimplePie might help, here -- quoting its FAQ, it's :
- A code library, written in PHP, intended to make it ridiculously easy for people to manage RSS and Atom feeds.
- An easy to use API that handles all of the dirty work when it comes to fetching, caching, parsing, normalizing data structures between RSS and Atom formats, handling character encoding translation, and sanitizing the resulting data.
Of couse, it will not do everything for you -- but it might help you get started.
Other solutions include, for instance, Zend_Feed_Reader
or MagpieRSS.
Pascal MARTIN
2010-01-10 14:56:50
certainly a much cleaner approach than rss2html. +1
Mef
2010-01-10 15:01:17
+2
A:
Try Magpie RSS. It can parse RSS feeds to arrays which you can easily iterate through and build your HTML.
Tatu Ulmanen
2010-01-10 14:57:12
+6
A:
In my Opinion Simplepie is one of the Best RSS parsers.
Here is an example:
require_once('simplepie.inc');
$feed = new SimplePie();
$feed->set_feed_url('http://simplepie.org/blog/feed/');
$feed->init();
$feed->handle_content_type();
<?php foreach ($feed->get_items(0, 5) as $item): ?>
<div class="item">
<h2 class="title"><a href="<?php echo $item->get_permalink(); ?>"><?php echo $item->get_title(); ?></a></h2>
<?php echo $item->get_description(); ?>
<p><small>Posted on <?php echo $item->get_date('j F Y | g:i a'); ?></small></p>
</div>
<?php endforeach; ?>
streetparade
2010-01-10 15:03:14