【问题标题】:How to get list of friend in my circle in Google +如何在 Google + 中获取我圈子中的朋友列表
【发布时间】:2015-05-28 23:40:30
【问题描述】:

我想获取我圈子 (Google+) 中的朋友列表。我没有得到那个清单;我的代码如下:

    require_once('assets/google/Google_Client.php');
    require_once('assets/google/contrib/Google_Oauth2Service.php');
    require_once('assets/google/contrib/Google_PlusService.php');
    $gClient = new Google_Client();
    $gClient->setApplicationName('Login to Google');
    $gClient->setClientId(GOOGLE_CLIENT_ID);
    $gClient->setClientSecret(GOOGLE_CLIENT_SECRET);
    $gClient->setRedirectUri($google_redirect_url);
    $gClient->setDeveloperKey(GOOGLE_DEVELOPER_KEY);
    $gClient->setScopes($scope);
    $google_oauthV2 = new Google_Oauth2Service($gClient);
    $google_plus = new Google_PlusService($gClient);
    if (isset($_GET['code'])){ 
        $gClient->authenticate($_GET['code']);
        $_SESSION['token'] = $gClient->getAccessToken();
        header('Location: ' .filter_var($google_redirect_url,FILTER_SANITIZE_URL));
        return;
    }
    $user = $google_oauthV2->userinfo->get();

我通过调用上述函数来获取我的详细信息

$peoples = $google_plus->people->listPeople('me','visible');

当我使用上述调用获取人员列表时,我获得的权限不足 (403)。谁能帮我解决这个问题?

【问题讨论】:

  • 访问这个developers.google.com/+/web/badge.. 他们提供的只是一些脚本,您可以在您的网站中使用
  • 你在用真实值替换GOOGLE_CLIENT_IDGOOGLE_CLIENT_SECRET等,不是吗?
  • 您是否从控制台启用了 api?你是在本地还是在服务器上尝试这个?
  • $scope的值是多少?
  • @deadman 您的评论与评论完全无关。

标签: php api google-plus


【解决方案1】:
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-03-07
  • 1970-01-01
相关资源
最近更新 更多