google indexing API错误请求400

时间:2019-06-06 12:37:40

标签: google-indexing-api

我已经完成域验证,为Google索引API创建了服务,但出现错误

[reasonPhrase:GuzzleHttp enter code here \ Psr7 \ Response:private] =>错误的请求 [statusCode:GuzzleHttp \ Psr7 \ Response:private] => 400

禁用索引API后,它显示401错误

require_once 'vendor/autoload.php';
$client = new Google_Client();
$client->setAuthConfig('civil-dolphin.json');
$client->addScope('https://www.googleapis.com/auth/indexing');
$httpClient = $client->authorize();
$endpoint = 'https://indexing.googleapis.com/v3/urlNotifications:publish';
$content = "{
  'url'': 'https://www.talkforweb.com.au',
  'type': 'URL_UPDATED'
}";
$response = $httpClient->post($endpoint, [ 'body' => $content ]);
$status_code = $response->getStatusCode();

它应该返回200

0 个答案:

没有答案