我试图使用PSHB协议来通知我的Google提醒。我使用的代码是here。但是,我不清楚如何实现回调(或端点)。Pubsubhubbub订阅PHP中的回调实现
有人可以提供一个简单的例子,说明我如何访问已发布到我的端点的数据?下面
A(略有修改)的谷歌代码的片段如下:
<?php
// simple example for the PHP pubsubhubbub Subscriber
// as defined at http://code.google.com/p/pubsubhubbub/
// written by Josh Fraser | joshfraser.com | [email protected]
// Released under Apache License 2.0
include("subscriber.php");
$hub_url = "http://pubsubhubbub.appspot.com";
$callback_url = "http://www.example.com/mycallback.php"; // <- how to implement this ?
[[编辑]]
我添加下面的伪代码,以帮助进一步澄清问题.. 。
// Implementation of mycallback.php
<?php
$pubsub_post_vars = $_POST[WHAT_NAME_AM_I_LOOKING_FOR]; //what's the name of the POST var?
// How do I get to the 'good stuff?
$feed_id = $pubsub_post_vars[SOME_VARIABLE]
$feed_title = $pubsub_post_vars[ANOTHER_VARIABLE]
$contents = $pubsub_post_vars[YET_ANOTHER_VARIABLE]
$author = $pubsub_post_vars[YET_ANOTHER_VARIABLE_1]
$perma_link = $pubsub_post_vars[YET_ANOTHER_VARIABLE_2]
$pub_date = $pubsub_post_vars[YET_ANOTHER_VARIABLE_3]
?>
我知道的方法(上图)可以是完整的错误的,因为我怀疑这是一个RSS/ATOM文件是PO STED。然而,像上面这样的一些框架代码应该足以让我开始,以便我可以提取诸如feed ID,标题和发布的内容等。
您是否找到了解决方案?你介意和我分享一下吗?我也遇到了回拨实施方面的问题。非常感谢你的帮助,非常感谢。 – overshadow 2014-08-07 04:57:00