如何在网站上获取带有 API 的 Google+ 社区帖子?

How to get Google+ Community posts with API on website?

我正在尝试从 public Google+ 社区获取 publics 帖子,我实际上使用的是 Google API PHP Client 但我没有找到如何获取社区供稿...

你能帮帮我吗?

谢谢。

我的 PHP 片段:

require_once __DIR__.'/google-api-php-client/src/Google/autoload.php';
require_once __DIR__.'/google-api-php-client/src/Google/Service.php';


$client = new Google_Client();
$client->setDeveloperKey("API_KEY");

$plus = new Google_Service_Plus($client);
$activities = $plus->activities->listActivities("113527920160449995981", "public");
?>

<html><body><pre><? var_dump($activities);?></pre></body></html>

并且输出:

object(Google_Service_Plus_ActivityFeed)#15 (14) {
  ["collection_key":protected]=>
  string(5) "items"
  ["internal_gapi_mappings":protected]=>
  array(0) {
  }
  ["etag"]=>
  string(57) """"
  ["id"]=>
  NULL
  ["itemsType":protected]=>
  string(28) "Google_Service_Plus_Activity"
  ["itemsDataType":protected]=>
  string(5) "array"
  ["kind"]=>
  string(17) "plus#activityFeed"
  ["nextLink"]=>
  NULL
  ["nextPageToken"]=>
  NULL
  ["selfLink"]=>
  NULL
  ["title"]=>
  string(48) "Google+ List of Activities for Collection PUBLIC"
  ["updated"]=>
  NULL
  ["modelData":protected]=>
  array(1) {
    ["items"]=>
    array(0) {
    }
  }
  ["processed":protected]=>
  array(0) {
  }
}

你不能。 Google+ API 不允许访问社区。

有一个开放的功能请求将此功能添加到 API:https://code.google.com/p/google-plus-platform/issues/detail?id=639