GoogleコンタクトAPIv3から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'],
);
}
}
あなたができることは、のURLを分割し/
、結果の最後のインデックスを取得することです。
例:
$url = "http://www.google.com/m8/feeds/contacts/mike%40xxxxxxx.com/base/xxxthisistheidxxxx";
$exploded = explode('/', $url);
echo end($exploded); //Echoes the last index.
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加