我有以下代码:
$url = sprintf("https://www.googleapis.com/calendar/v3/calendars/calendarname/events/watch");
/* setup the POST parameters */
$fields = json_encode(array(
'id' => "012345423-2ab-cdef-01345232789ab",
'type' => "web_hook",
'address' => sprintf("https://mysite/response/")
));
$access_token = 'access-token';
/* setup POST headers */
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Bearer ' . $access_token;
/* send POST request */
$channel = curl_init();
curl_setopt($channel, CURLOPT_HTTPHEADER, $headers);
curl_setopt($channel, CURLOPT_URL, $url);
curl_setopt($channel, CURLOPT_RETURNTRANSFER, true);
curl_setopt($channel, CURLOPT_POST, true);
curl_setopt($channel, CURLOPT_POSTFIELDS, $fields);
curl_setopt($channel, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($channel, CURLOPT_TIMEOUT, 3);
$response = curl_exec($channel);
curl_close($channel);
print_r($response);
我怎么会收到未经授权的网址错误。我已在搜索控制台中注册了我的网站,并在搜索控制台页面的主页上显示了该网站。我无法在此处识别错误。