无法更新在本地主机中运行Google Sheet API的电子表格属性403

时间:2019-02-08 07:34:03

标签: php curl google-api google-sheets-api

$ch = curl_init();      
//curl_setopt($ch, CURLOPT_URL, 'https://www.googleapis.com/drive/v3/files/16N02geLBfDG3GT3xsrtZB5OjBuEp7P9Faofpm0hyDh8');
//google api url+google sheet id

curl_setopt($ch,CURLOPT_URL,'https://www.googleapis.com/drive/v3/files/16N02geLBfDG3GT3xsrtZB5OjBuEp7P9Faofpm0hyDh8');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);        
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');   
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_VERBOSE , TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer '. $access_token, 'Content-Type: application/json')); 
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($curlPost));

$data = json_decode(curl_exec($ch), true);
$http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);

if($http_code != 200) 
  exit('Error : Failed to update spreadsheet properties '. $http_code);
}

0 个答案:

没有答案