laravel 尝试通过获取错误hub.mode无效向Google WebSub发送请求

cclgggtu  于 2023-04-13  发布在  Go
关注(0)|答案(1)|浏览(87)

我试图使用以下代码发布更新到WeSub,但我收到错误
集线器模式无效

function sendWebSubNotification($topicUrl) {

    $response = Http::post("https://pubsubhubbub.appspot.com/", [
        'hub.mode' => 'publish',
        'hub.url' => $topicUrl,
    ], [
        'Content-Type' => 'application/x-www-form-urlencoded'
    ]);

    echo $response->getBody();

    if ($response->ok()) {
        // Ping successful
        return true;
    } else {
        // Ping failed
        return false;
    }

}
0sgqnhkj

0sgqnhkj1#

在Laravel中使用asForm()发送URL编码的POST请求:

$response = Http::asForm()->post("https://pubsubhubbub.appspot.com/", [
    'hub.mode' => 'publish',
    'hub.url' => $topicUrl,
]);

相关问题