如何通过 PHP 使用 Superfeedr
我正在开发一个解析大量 RSS 提要的项目,我刚刚发现 Superfeedr 在如何使用其 PubSubHubbub PHP API。
请问有人可以给我一个很好的教程或示例如何使用它来订阅任何提要吗?
谢谢你,
I'm working on a project that parse a lot of RSS feeds, and I just discover Superfeedr it has a poor documentation in how to use their PubSubHubbub API with PHP.
Please can anyone give me a good tutorial or an example how to use it to subscribe to any feed?
Thank you,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Superfeedr的API实际上是PubSubHubbub协议,所以我想第一步是找到实现PubSubHubbub的好方法。这里有一些链接,像这个,或这个。
Superfeedr's API is actually the PubSubHubbub protocol, so I guess the first step would be to find the good way to implement PubSubHubbub. There are a few links in here, like this one, or this one.
我以前去过那里。结论如下:
1. 在您的服务器上创建一个 PHP 文件,并将其命名为 endpoint.php,因此文件的 url 应该类似于 http://yoursite.com/endpoint.php
您的 PHP 文件应该做两件事,订阅/取消订阅提要,在本例中您应该(仅)在文件中写入的所有内容都是 hub_challenge
成功订阅您的提要后,您应该(自动接收)来自 superfeeder 的新 rss 内容。使用 PHP 你应该收到这样的内容
添加 rss 链接的方式非常简单,只需在屏幕右上角的帐户链接上访问 superfeedr.com,单击它,然后选择仪表板。
单击 xmpp,您将找到所有提要的列表。您还可以添加新提要。
输入 rss 链接 (http://example.com/rss.xml) 和您的回调 (endpoint.php) 文件。类似于 http://yoursite.com/endpoint.php。
按照文档中所述,使用 GET 请求进行卷曲调用。
I was there before. Here is the conclusion:
1. create a PHP file on your server and call it for example endpoint.php so the url of your file should be something like http://yoursite.com/endpoint.php
Your PHP file should do two things, subscribe/unsubscribe feeds and in this case all what you should write (only) in your file is the hub_challenge
After successfully subscribing your feeds you should (automatically recieve) new rss contents from superfeeder. Using PHP you should recieve contents like this
The way you add rss link is very simple, just visit superfeedr.com on your account link in the top right of the screen click on it then select dashboard.
click xmpp you will find a list of all your feeds.you can also add new feed.
enter the rss link (http://example.com/rss.xml) and your callback (endpoint.php) file.something like http://yoursite.com/endpoint.php
if you want to add it by PHP code (in any php file).make a curl call with GET request as descibed in documentation.