开发者

PubSubHubbub error to confirm subscription

开发者 https://www.devze.com 2023-01-21 09:57 出处:网络
I use this code: <?php if(isset($_GET[\"hub_challenge\"])) { echo $_GET[\"hub_challenge\"]; } else { } $ch = curl_init(\"http://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.app开发者_如何学Gospot.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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消