0
Google APIを初めて使用しており、People APIを使用してユーザーの連絡先をすべて取得したいと考えています。 それは動作しますが、私は、ユーザーを認証することができますし、次のように私は人々APIを呼び出す:PHPを使用してGoogle People APIから返された連絡先データを読む方法
$contacts = $peopleService->people_connections->listPeopleConnections('people/me');
foreach ($contacts as $contactItem) {
$this->print_r2($contactItem);
}
をしかし、私はタイプGoogle_Service_People_ListConnectionsResponseのオブジェクトを取得します。
Google_Service_People_ListConnectionsResponse Object
(
[collection_key:protected] => connections
[internal_gapi_mappings:protected] => Array
(
)
[connectionsType:protected] => Google_Service_People_Person
[connectionsDataType:protected] => array
[nextPageToken] =>
[nextSyncToken] => CPDp4aW_KhIBMRjuEioECAAQAQ
[modelData:protected] => Array
(
[connections] => Array
(
[0] => Array
(
[resourceName] => people/c3422388075840417635
[etag] => AgD+4rTZF6o=
[metadata] => Array
(
[sources] => Array
(
[0] => Array
(
[type] => CONTACT
[id] => 2fc3d288898002f63
[etag] => #AgD+4rTZF6o=
)
)
[deleted] => 1
[objectType] => PERSON
)
)
[1] => Array
(
[resourceName] => people/107483842333347794768
[etag] => btQbbIVcGJ4=
[metadata] => Array
(
[sources] => Array
(
[0] => Array
(
[type] => CONTACT
[id] => 715e58866e51e374
[etag] => #TW+s5999ANk=
)
[1] => Array
(
[type] => PROFILE
[id] => 107483842299147794768
)
)
[objectType] => PERSON
)
[names] => Array
(
[0] => Array
(
[metadata] => Array
(
[primary] => 1
[source] => Array
(
[type] => CONTACT
[id] => 715e50000e51e374
)
)
[displayName] => xxxxxxxx
[familyName] => xxxxxx
[givenName] => xxxxxxxxx
[displayNameLastFirst] => xxxxx, xxxxx
)
[1] => Array
(
[metadata] => Array
(
[source] => Array
(
[type] => PROFILE
[id] => *************************
)
)
[displayName] => xxxxxxxxxx
[familyName] => xxxxx
[givenName] => xxxxxxx
[displayNameLastFirst] => xxxxx, xxxxxxx
)
)
...。 .....
私の質問はちょっと愚かです:PHPクライアントライブラリを使って、[modelData:protected]配列をどのようにして読み込むのですか?
[配列PHPをループ]の可能な重複(http://stackoverflow.com/questions/4414623/loop-through-an-array-php) – DaImTo