【发布时间】:2018-02-27 11:28:46
【问题描述】:
我在这个网站上看到过类似的帖子,但没有一个能解决我的问题,api 版本已经改变,一些端点已被弃用。
当我使用时,即使是 Graph API Explorer,我也会收到包含空数据的响应。
// Instantiating the Facebook class
$this->api = new Facebook([
'app_id' => $ apiId,
'app_secret' => $ apiSecret,
'default_graph_version' => 'v2.11',
]);
....
// Creating the authentication link
$helper = $this->api->getRedirectLoginHelper();
$permissions = ['manage_pages', 'publish_pages', 'read_insights']; // Optional permissions
$loginUrl = $helper->getLoginUrl ('http://dev2.example.co/smms/index.php?id=16', $permissions);
...
// Getting the total of likes of the page (the endpoint 'fan_count' does not work for this version)
$this->api->get('/'.$this->id_profile.' / likes', $this->getAccessTokenAttribute())
结果为空,访问令牌在所有情况下都是正确的。
另一方面,当我只调用页面上的信息时,它只传递页面名称和id的数据
protected 'decodedBody' =>
array (size = 2)
'name' => string 'Test Page' (length = 9)
'id' => string '1989831694572991' (length = 16)
如果您能指导我获取页面上的所有信息,我将不胜感激。我不知道是否缺少任何页面级别的权限来实现它。
我正在使用 TYPO3 7.6 和 PHP 5.6。
【问题讨论】:
-
不,
/likes不是页面粉丝数,它是您页面喜欢的其他页面的列表。fan_count是正确的字段,它在 API v2.11 中运行良好,developers.facebook.com/tools/… 很容易证明。
标签: php facebook facebook-graph-api typo3