Google People API in PHP



我尝试实现People API,在成功后 OAuth2,当尝试加载人员时,错误是:

Undefined property: Google_Service_People_Resource_People::$connections

这是产生错误的行:

$people_service = new Google_Service_People($client);
$connections = $people_service->people->connections->listConnections('people/me');

我要通过这个教程https://developers.google.com/people/v1/getting-started,还有这个:https://developers.google.com/people/v1/requests.

谢谢

我想你是在找…

$connections = $people_service->people_connections->listPeopleConnections('people/me');

我们已经编写了一个PHP Google People API库,可能会有所帮助。它使得通过Google People API实现对Google Contacts的访问比使用Google自己的库要容易得多。

链接: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();

相关内容

  • 没有找到相关文章

最新更新