Reputation: 3547
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?
Upvotes: 1
Views: 905
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