user4741913
user4741913

Reputation:

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

I'm trying to get publics posts from a public Google+ Community, I'm actually use Google API PHP Client but I don't found how to get communities feed...

Could you, please, help me?

Thanks.

My PHP snippet :

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>

And the output :

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) {
  }
}

Upvotes: 0

Views: 624

Answers (1)

Scarygami
Scarygami

Reputation: 15549

You can't. The Google+ API doesn't allow access to communities.

There's an open feature request to add this functionality to the API: https://code.google.com/p/google-plus-platform/issues/detail?id=639

Upvotes: 1

Related Questions