我已获得用户访问代码以及具有权限manage_pages和read_insights
权限的页面访问权限$ accessToken存储访问令牌
如何使用以下指标:page_impressions或page_impressions_unique
$request = new FacebookRequest(
$session,
'GET',
'/{object-id}/insights/{metric-name}'
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
但是这里的$ session变量是什么,我应该如何打印结果
答案 0 :(得分:0)
这里$ session变量意味着FacebookApp对象
$session = new FacebookApp('{app-id}', '{app-secret}');
$request = new FacebookRequest($session, '{access-token}', 'GET', '/{object-id}/insights/{metric-name}');
或者你可以试试这个
FacebookSession::setDefaultApplication('my-app-id', 'my-app-secret');
$session = new FacebookSession('my-access-token');
$request = new FacebookRequest($session, 'GET', '/me/accounts?fields=name,id');