facebook:如何获取群组资讯?

时间:2016-05-02 11:48:14

标签: php facebook session facebook-graph-api

我正在尝试从facebook组获取提要,我使用了facebook图形API(PHP sdk),这里是来自facebook docs的示例:

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

$session应该是什么?我怎么声明呢?

facebook docs

1 个答案:

答案 0 :(得分:1)

使用此代码制作请求投放图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');