Skip to content

Instantly share code, notes, and snippets.

@ianbarber
Created March 6, 2014 04:46
Show Gist options
  • Save ianbarber/9382834 to your computer and use it in GitHub Desktop.
Save ianbarber/9382834 to your computer and use it in GitHub Desktop.
<?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