PubSubHubbub 确认订阅时出错
我使用此代码:
<?php
if(isset($_GET["hub_challenge"])) {
echo $_GET["hub_challenge"];
}
else {
}
$ch = curl_init("http://pubsubhubbub.appspot.com");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,"hub.mode=subscribe&hub.verify=sync&hub.callback=http://rssreaderbg.net/pubsubbub/example/index.php&hub.topic=http://rssreaderbg.net/blog/?feed=comments-rss2");
curl_exec($ch);
file_put_contents("logmeme.txt",$HTTP_RAW_POST_DATA);
?><?php
if(isset($_GET["hub_challenge"])) {
echo $_GET["hub_challenge"];
}
else {
}
$ch = curl_init("http://pubsubhubbub.appspot.com");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,"hub.mode=subscribe&hub.verify=sync&hub.callback=http://rssreaderbg.net/pubsubbub/example/index.php&hub.topic=http://rssreaderbg.net/blog/?feed=comments-rss2");
curl_exec($ch);
file_put_contents("logmeme.txt",$HTTP_RAW_POST_DATA);
?>
但是 pubsubhubbub.appspot.com 的中心给我“尝试确认订阅时出错”,为什么?
I use this code:
<?php
if(isset($_GET["hub_challenge"])) {
echo $_GET["hub_challenge"];
}
else {
}
$ch = curl_init("http://pubsubhubbub.appspot.com");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,"hub.mode=subscribe&hub.verify=sync&hub.callback=http://rssreaderbg.net/pubsubbub/example/index.php&hub.topic=http://rssreaderbg.net/blog/?feed=comments-rss2");
curl_exec($ch);
file_put_contents("logmeme.txt",$HTTP_RAW_POST_DATA);
?><?php
if(isset($_GET["hub_challenge"])) {
echo $_GET["hub_challenge"];
}
else {
}
$ch = curl_init("http://pubsubhubbub.appspot.com");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch,CURLOPT_POSTFIELDS,"hub.mode=subscribe&hub.verify=sync&hub.callback=http://rssreaderbg.net/pubsubbub/example/index.php&hub.topic=http://rssreaderbg.net/blog/?feed=comments-rss2");
curl_exec($ch);
file_put_contents("logmeme.txt",$HTTP_RAW_POST_DATA);
?>
But the hub at pubsubhubbub.appspot.com gives me "Error trying to confirm subscription" ,why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最简单的解决方案是尝试自己执行订阅验证。
使用规范中所述的参数向您的回调发送 GET 请求。确保您的回调返回 2XX 并且仅回显集线器提供的
hub.challenge
。The simplest solution is to try performing a subcription verification yourself.
Send a GET request to your callback with the params as explained in the spec. Make sure your callback returns a 2XX and only echoes the
hub.challenge
provided by the hub.