Are there any free php/javascript libraries out there which would help in displaying an RSS feed as html?
4条回答 默认 最新
- dsvyc66464 2010-01-10 15:03关注
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; ?>
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报