如何使用订阅者选项?
我现在开始使用 Pubsubhubbub (以及所有关于实时的东西),但我在订阅者选项方面遇到了麻烦。
我正在尝试用 PHP 开发一个 web 应用程序来:
- 订阅 RSS(之前发布的)到 Hub (http:// pubsubhubbub.appspot.com/);
- 从订阅中心读取通知(更新); 没有成功! :(
我验证php 到订阅者中存在一个库(在git),但是 使用此库无法使订阅工作(出现 409 错误!)。
我该怎么做?
I started now with Pubsubhubbub (and all about realtime things), but I amhaving trouble with the Subscriber option.
I'm trying to develop a webapp in PHP to:
- Subscribe a RSS (previously Published) to the Hub (http://pubsubhubbub.appspot.com/);
- Read notifications (updates) from the Hub for the subscription;
without succeed!!! :(
I verify that exist a library in php to the Subscriber (in Git), but
using this lib can't make the Subscribe work's (get a 409 error!).
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我尝试的第一件事就是忘记库,并尝试准确理解订阅者上下文中发生的情况。构建一个同时处理所有这些的脚本应该非常非常简单。
订阅者应用程序必须做两件事:
那么让我们开始吧:
hub.challenge
参数并返回 200。curl -X POST http://pubsubhubbub.appspot.com/ -d'hub.mode=subscribe' -d'hub. verify=sync' -d'hub.topic=http://the.feed.url' -d'hub.callback=http://the.script.url' -D-
如果一切正常,您发送的卷曲请求应该告诉您集线器返回了 204。如果您收到其他任何信息,请检查正文 。
稍后...
我希望这对您有帮助。 rel="nofollow">还可以使用此工具来调试您需要帮助的订阅。
The first thing I'd try is forget about libraries and try to understand what's happening in the context of a subscriber exactly. It should be really really straightforward to build a script that handles all this together.
A subscriber application must do 2 things :
So let's start :
hub.challenge
param that it gets in the response's body and returns 200.curl -X POST http://pubsubhubbub.appspot.com/ -d'hub.mode=subscribe' -d'hub.verify=sync' -d'hub.topic=http://the.feed.url' -d'hub.callback=http://the.script.url' -D-
If this was all fine the curl request that you send should tell you that the hub returned a 204. If you get anything else, check the body of the response, it will indicate you what went wrong.
Later...
I hope this helps. You can also use this tool to debug your subscription of you need help.
这是一个老问题,并且 ddluis 链接的 PHP 库有很多缺陷。
Google 代码 wiki 中推荐的 PHP 订阅者是 PuSHSubscriber:
http://github.com/lxbarth/PuSHSubscriber/
更新:
我分叉了 PuSHSubscriber:http://github.com/bobdia/PuSHSubscriber< /a>
我做了一些与原始版本不兼容的更改。可以在 /example 目录中找到一个简单的实现。这并不意味着实际使用,仅用于演示目的。我希望你觉得它有用。
This is an old question and the PHP library ddluis linked to has many flaws.
The recommended PHP subscriber in the Google Code wiki is PuSHSubscriber:
http://github.com/lxbarth/PuSHSubscriber/
UPDATE:
I forked PuSHSubscriber: http://github.com/bobdia/PuSHSubscriber
I've made a few incompatible changes with the original. A simple implementation can be found in the /example directory. This is not meant for real use, just for demonstration purposes. I hope you find it useful.
一些可能有用的代码,以及良好的文档:
示例提要聚合器:
Some code that may be helpful, with good docs:
Example feed agregator: