Mohammad
Mohammad

Reputation: 3547

facebook: how to get group feeds?

I am trying to get feeds from a facebook group, I used the facebook graph API (PHP sdk), here is an example from the facebook docs:

$request = new FacebookRequest(
  $session,
  'GET',
  '/{group-id}/feed'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();

what the $session should be? how I can declare it?

facebook docs

Upvotes: 1

Views: 905

Answers (1)

Pavel Krasnoperov
Pavel Krasnoperov

Reputation: 186

Use this code to make request throw graph API

$fb = new Facebook\Facebook([
  'app_id' => '{app-id}',
  'app_secret' => '{app-secret}',
  'default_graph_version' => 'v2.2',
  ]);

// Since all the requests will be sent on behalf of the same user,
// we'll set the default fallback access token here.
$fb->setDefaultAccessToken('user-access-token');

$requestUserName = $fb->request('GET', '/{group-id}/feed');

Upvotes: 1

Related Questions