Search code examples
phpgoogle-contacts-api

How to retrieve the birthday of a Contact?


I am able to get the name and address and more from a contact with the Contacts API v3. However I just cant seem to figure out how to get the birthday. I have found this link though, but I don't really understand it since its quite different from the others.

$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'],

//I need to know what tu put here
    'birthday' => $contact['gcontact$birthday'],
);

Solution

  • Add this in your code to get the birthday from the contacts API

     'birthday' => $contact['gContact$birthday']['when'],