PHP中的RSS提要 [英] RSS feeds in PHP

查看:74
本文介绍了PHP中的RSS提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是想知道是否有人可以建议一个PHP库,该库将允许我读取RSS feed的数据并将其写入MySQL数据库.另外,如果可能,提供有关如何执行此操作的文档的链接?

Just wondering if someone could suggest a PHP library that would allow me to read the data of an RSS feed and write it to a MySQL database. Also, if possible, provide a link to documentation about how to do this?

谢谢

推荐答案

RSS是一种非常简单的格式-无需使用单独的库.

RSS is a pretty simple format - there is no great need to use a separate library.

我只会使用 simplexml ,因为我不想花时间去学习另一个库,并跟上它的发展.

I'd just use simplexml, because I don't wanna spend the effort learning another library, and keeping up with its development.

这是一个简单的PHP脚本,用于显示带有simplexml的最新Stackoverflor帖子:

Here is a simple PHP script for showing the latest Stackoverflor posts with simplexml:

<?php
$rss = simplexml_load_file('http://stackoverflow.com/feeds');
?>
<h1><?php echo $rss->title; ?></h1>
<ul>
<?php
foreach($rss->entry as $e) {
    echo "<li><a href=\"".$e->link['href']."\">";
    echo $e->title; 
    echo "</a></li>\n";
}    
?>
</ul>

这篇关于PHP中的RSS提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆