不支持的获取请求-Facebook API [英] Unsupported get request - Facebook API
问题描述
我正在尝试通过Facebook API获取Facebook Pages的提要.
I am trying to get a Facebook Pages' feed through the Facebook API.
将我的页面之一-koodoocreative放入我的代码中,根本没有问题.
Putting one of my pages - koodoocreative into my code brings back the data no problem at all.
但是当我尝试将其中一个客户端加载到API中时,我收到消息...
But when I've tried loading in one of our clients into the API, I get the message...
不支持的获取请求
Unsupported get request
随附的是页面权限的图像
Attached is an image of the pages' permissions
我的PHP代码如下....
My PHP code is as follows....
// init app with app id (APPID) and secret (SECRET)
FacebookSession::setDefaultApplication('','');
$session = new FacebookSession('');
// First Get The Groups' Details...
$request = new FacebookRequest(
$session,
'GET',
'/'.$app_view->app_view_title
);
$response = $request->execute();
$graphObject = $response->getGraphObject();
$page_name = $graphObject->getProperty('name');
// Next Get The Posts...
$request = new FacebookRequest(
$session,
'GET',
'/'.$app_view->app_view_title.'/feed?limit=10'
);
$response = $request->execute();
$object = $response->getGraphObject();
$fbdata = $object->getPropertyAsArray('data');
?>
推荐答案
问题是您在页面上使用用户名,例如/koodoocreative,而客户可能未必拥有此功能.您应该改用数字页面ID,这样,API调用将适用于带有和不带有虚名URL的页面.
The issue is that you're using username for the pages, e.g. /koodoocreative, whereas the client may not necessarily have this. You should use numerical Page IDs instead, this way, the API call will work for pages with and without vanity URLs.
这篇关于不支持的获取请求-Facebook API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!