[英]Google People API in PHP
I try to implement People API, after successfully OAuth2, when try to load people, error is: 我尝试实现People API, 成功执行 OAuth2后,当尝试加载人员时,错误是:
Undefined property: Google_Service_People_Resource_People::$connections
This is lines who produce error: 这是产生错误的行:
$people_service = new Google_Service_People($client);
$connections = $people_service->people->connections->listConnections('people/me');
Am going by this tutorial https://developers.google.com/people/v1/getting-started , and this: https://developers.google.com/people/v1/requests . 我正在通过本教程https://developers.google.com/people/v1/getting-started进行操作 ,以及: https : //developers.google.com/people/v1/requests 。
Thanks 谢谢
我想您正在寻找...
$connections = $people_service->people_connections->listPeopleConnections('people/me');
We've written a PHP Google People API library that might help. 我们已经编写了一个可能有帮助的PHP Google People API库。 It makes implementing access to Google Contacts via the Google People API much easier than using Google's own library.
与使用Google自己的库相比,通过Google People API实现对Google联系人的访问要容易得多。
Link: https://github.com/rapidwebltd/php-google-people-api 链接: https : //github.com/rapidwebltd/php-google-people-api
// Retrieval all contacts
foreach($people->all() as $contact) {
echo $contact->resourceName.' - ';
if ($contact->names) {
echo $contact->names[0]->displayName;
}
echo PHP_EOL;
}
// Retrieve single contact (by resource name)
$contact = $people->get('people/c8055020007701654287');
// Create new contact
$contact = new Contact($people);
$contact->names[0] = new stdClass;
$contact->names[0]->givenName = 'Testy';
$contact->names[0]->familyName = 'McTest Test';
$contact->save();
// Update contact
$contact->names[0]->familyName = 'McTest';
$contact->save();
// Delete contact
$contact->delete();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.