foreach($contacts['feed']['entry'] as $contact){
$return[] = array(
'id'=>$contact['id']['$t'],
'name' => $contact['title']['$t'],
'phone' => isset($contact['gd$phoneNumber'][0]['$t']) ? $contact['gd$phoneNumber'][0]['$t'] :false,
);
}
$count = -1;
$contactId;
foreach($return as $value) {
$count++;
if ((strcmp($value['name'], $checkname) == 0) && (strcmp($value['phone'], $oldphone) == 0)) {
$contactid=$value['id'];
}
}
/* The code with problem starts here:*/
$service = new Google_Service_Mirror($client);
$updatedContact = $service->contacts->get($contactId);
$updatedContact->setDisplayName($putname);
$updatedContact->setPhoneNumber($newphone);
return $service->contacts->update($contactId, $updatedContact);
/*The code with problem ends here:*/
我无法更新Google通讯录中的联系人。似乎缺少一些授权。
调用GET时出错 https://www.googleapis.com/mirror/v1/contacts/http%3A%2F%2Fwww.google.com%2Fm8%2Ffeeds%2Fcontacts%2Fshisindood%2540gmail.com%2Fbase%2F1762fb1e0dca10ef (403)许可不足
请告诉我,我需要做些什么才能解决问题。上面的代码只是一个摘录。如果需要,请问我更多代码。谢谢。