我正在搜索用 PHP 编写的 RSS 解析器。问题不是我找不到。问题是太多了,很难决定使用哪一个(特别是当我没有使用它们的经验并且尝试它们太耗时时)。
有人能给我推荐一个“好的”RSS 解析器吗?
以下要求对我来说很重要(按重要性顺序给出):
- 它能够提取提要中给出的所有信息(不仅是标题、描述和链接,还有其中的所有内容,例如提要作者、提要图标、项目标签和很快)。
- 它不仅应该能够读取 RSS 提要,还应该能够读取 Atom 提要。
- 它应该能够容忍“损坏的”RSS (Atom) 提要。
- 使用起来应该很简单。
I am searching an RSS parser written in PHP. The problem is not that I cannot find one. The problem is that there are too many and it's hard to decide which one to use (especially when I have no experience with them and to try them is too time consuming).
Can anybody recommend me a "good" RSS parser?
The following requirements are important to me (given in order of importance):
- It's able to extract all information given in the feed (not only title, description and link but everything what is there, for example feeds author, feeds icon, items tags and so on).
- It should be able to read not only RSS feeds but also Atom feeds.
- It should be tolerant to "broken" RSS (Atom) feeds.
- It should be simple to use.
发布评论
评论(2)
我事实上的答案是“你尝试过 SimplePie 吗?”,它是一个非常好的 XML 解析器,但你必须这样做看看他们的演示,看看它如何处理损坏的提要:-)
My defacto answer will be "have you tried SimplePie?", it's a very good XML parser but you'll have to have a look at their demo to see how it handles broken feeds :-)
除了已经提到的 SimplePie 之外,还有 Zend_Feed (可以使用独立)并且由于无论如何这是 XML,因此您还可以使用 任何本机 XML 扩展,例如 DOM 或 XMLReader。
In addition to SimplePie already mentioned, there is Zend_Feed (which can be used standalone) and since this is XML anyway, you can also use any of the native XML extensions, like DOM or XMLReader.