i want to save the email address of the logged user into Google account. I'm working with Google Calendar API. This is the code in PHP
$obj = new Google_Client(array('use_objects' => true));
$obj->setApplicationName("");
// Visit https://code.google.com/apis/console to generate your
// oauth2_client_id, oauth2_client_secret, and to register your oauth2_redirect_uri.
$obj->setClientId('');
$obj->setClientSecret('');
$obj->setRedirectUri('');
$obj->setDeveloperKey('');
$obj->setScopes(array('https://www.googleapis.com/auth/calendar','https://www.googleapis.com/auth/userinfo.email','https://www.googleapis.com/auth/userinfo.profile'));
$client = new Google_CalendarService($obj);
$abc = new Google_Oauth2Service($obj);
i set the scope to recover the email and also use Calendar API, but this don't work
try{
$user = $abc -> userinfo -> get();
}
catch(Exception $e){
echo "Mail non trovata<br />.";
}
$email = filter_var($user['email'], FILTER_SANITIZE_EMAIL);
print $email;
the get() function don't work and i don't know why