Created
March 6, 2014 04:46
-
-
Save ianbarber/9382834 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// $client is authenticated with scopes "profile" and "email" | |
$service = new Google_Service_Plus($client); | |
$user = $service->people->get("me"); | |
$name = $user->displayName; | |
$family_name = $user->name->familyName; | |
$given_name = $user->name->givenName; | |
$picture = $user->image->url; | |
// There can be > 1 email address, we want the main one | |
foreach($user->emails as $em) { | |
if($em->type == "account") { | |
$email = $em->value; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment