将 RSS feed 中的内容提取到 php 文件中
如果这看起来是一个愚蠢的问题,我很抱歉,但我是这个领域的新手,任何帮助将不胜感激。那么问题来了 - 假设如果我有一个特定网站的 RSS 提要,并且我想提取其内容并将其存储在 PHP 脚本中,我该怎么做?我想定义特定的名称,如 $title、$tag、$date 等,并将提取的内容保存到我的数据库中并从那里使用它。目前,我正在使用 http://dapper.com 来实现此目的,但它太慢且不准确,所以我想手动执行。如果您可以建议我一种执行此操作的方法或引导我访问一些在线链接,那将会有很大的帮助。谢谢。
I am sorry if this seems like a stupid question but I am a newbie in this field and any help would be really appreciated. So here's the question- Suppose if I have a RSS feed of a particular site and I want to extract its content and store it in a PHP script, how would I do it? I want to define particular names like $title, $tag, $date etc and save the extracted content into my database and use it from there. Currently, I am using http://dapper.com for this purpose but it is too slow and inaccurate, so I want to do it manually. If you could suggest me a way of doing this or direct me to some links online, it would be of great help. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
RSS 提要是一个 xml 文件。使用 simplexml:http://us.php.net/simplexml。这是一篇博客文章,展示了它是多么简单,并提供了一个快速卷曲示例来展示如何获取实际的提要数据: http://return-true.com/2010/04/parsing-a-rss-feed-with-php-using-simplexml/
An rss feed is an xml file. Use simplexml: http://us.php.net/simplexml. Here's a blog post showing just how easy it is, and throws in a quick curl example to show how to fetch the actual feed data: http://return-true.com/2010/04/parsing-a-rss-feed-with-php-using-simplexml/
有许多专门为 RSS 解析编写的 PHP 类。
您可能想尝试 magpierss。
There are many PHP classes written specifically for RSS parsing.
You might want to try magpierss.