使用 Superfeedr PubSubHubbub 订阅生成错误 hub.topic 未找到

Subscribe using Superfeedr PubSubHubbub generating error hub.topic not found

我想在 PHP 中使用 PubSubHubbub 集成 Superfeedr API。我正在关注 this,我的代码是:

<?php

 require_once('Superfeedr.class.php')
 $superfeedr = new Superfeedr('http://push-pub.appspot.com/feed', 
                            'http://mycallback.tld/push?feed=http%3A%2F%2Fpush-pub.appspot.com%2Ffeed',
                            'http://wallabee.superfeedr.com');

 $superfeedr->verbose = true;
 $superfeedr->subscribe();
?>

我的 subscribe() 函数是

public function subscribe()
{
    $this->request('subscribe');
}

private function request($mode)
{
    $data = array();
    $data['topic'] = $this->topic;
    $data['callback'] = $this->callback;

    $post_data = array ( 
            "hub.mode" => 'subscribe', 
            "hub.verify" => "sync", 
            "hub.callback" => urlencode($this->callback), 
            "hub.topic" => urlencode($this->topic),
            "hub.verify_token" => "26550615cbbed86df28847cec06d3769",
    ); 
//echo "<pre>"; print_r($post_data); exit;

    // url-ify the data for the POST 
    foreach ($post_data as $key=>$value) { 
        $post_data_string .= $key.'='. $value.'&'; 
    } 
    rtrim($fields_string,'&'); 

    // curl request
    $ch = curl_init(); 

    curl_setopt($ch, CURLOPT_URL, $this->hub); 
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); 
    curl_setopt($ch, CURLOPT_POST, true); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data_string); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
    curl_setopt($ch, CURLOPT_HEADER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json'));
    curl_setopt($ch, CURLOPT_USERPWD, 'USERNAME:PASSWORD');
    $output = curl_exec($ch);


    if ($this->verbose) {
        print('<pre>'); 
        print_r($output); 
        print('</pre>');
    }   
}   

但是在执行后我得到这个错误

HTTP/1.1 422 Unprocessable Entity
X-Powered-By: The force, Luke
Vary: X-HTTP-Method-Override, Accept-Encoding
Content-Type: text/plain; charset=utf-8
X-Superfeedr-Host: supernoder16.superfeedr.com
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Authorization
Content-Length: 97
ETag: W/"61-db6269b5"
Date: Wed, 24 Aug 2016 14:01:47 GMT
Connection: close

Please provide a valid hub.topic (feed) URL that is accepted on this hub. The hub does not match.

https://superfeedr.com/users/testdata/push_console 请求相同的数据(主题和回调等) 工作正常。但我不知道为什么我在本地会收到此错误。如果有人遇到过同样的问题,请帮助我。谢谢。

您正在使用一个奇怪的集线器 URL。您应该在 class 构造函数的最后一个参数中使用 HTTPS://push.superfeedr.com