如何使用google-api-php-client库列出经过身份验证的用户的Google +商业页面?
到目前为止,我可以使用代码页查看用户个人信息以及来自用户的Google +页面的供稿:
require_once 'gplus/Google_Client.php';
require_once 'gplus/contrib/Google_PlusService.php';
$client = new Google_Client();
$client->setClientId('xxxxx.apps.googleusercontent.com');
$client->setClientSecret('xxxxx');
$client->setRedirectUri('https://mywebsite.com/redirect');
$client->authenticate($code);
$token = $client->getAccessToken();
//Get only access token
$access_token_arr = json_decode($token);
$access_token = $access_token_arr->access_token;
//Get user info
$url = 'https://www.googleapis.com/oauth2/v1/userinfo?access_token='.$access_token;
$gplus_user = json_decode(file_get_contents($url)); //This gives me personal information about the user.