【发布时间】:2016-02-16 10:50:51
【问题描述】:
我正在尝试从 Google Contacts API v3 检索 ID。我能够检索到最后带有 id 的整个 url。
http://www.google.com/m8/feeds/contacts/mike%40xxxxxxx.com/base/xxxthisistheidxxxx
所以我要么以某种方式拆分了 url,要么我需要找到一种完全不同的方式来检索 ID。
if (!empty($contacts['feed']['entry'])) {
foreach($contacts['feed']['entry'] as $contact) {
//retrieve Name and email address
$return[] = array (
'firstname'=> $contact['gd$name']['gd$givenName']['$t'],
'lastname'=> $contact['gd$name']['gd$familyName']['$t'],
'email' => $contact['gd$email'][0]['address'],
'phoneNumber' => $contact['gd$phoneNumber'][0]['$t'],
'city' => $contact['gd$structuredPostalAddress'][0]['gd$city']['$t'],
'street' => $contact['gd$structuredPostalAddress'][0]['gd$street']['$t'],
'country' => $contact['gd$structuredPostalAddress'][0]['gd$country']['$t'],
'birthday' => $contact['gContact$birthday']['when'],
'id' => $contact['id']['$t'],
);
}
}
【问题讨论】:
标签: php google-app-engine google-api google-contacts-api