没有身份验证令牌的Facebook Feed
$pageID = "ID of Page"
$url = "https://graph.facebook.com/". $pageID ."/feed";
$json = file_get_contents($url);
$jsonData = json_decode($json);
foreach($jsonData->data as $val) {
if($val->from->id == $pageID) { //find the first matching post/status by a fan page admin
$message = $val->message;
echo $message;
break; //stop looping on most recent status posted by page admin
}
}
我在google上搜索时发现了这段代码。但我按照他们的帖子所说的那样做了,但是现在它不起作用了?
答案 0 :(得分:3)
这是不可能的。看看这个。
此请求:https://graph.facebook.com/cocacola/feed
返回此回复:
{
"error": {
"message": "An access token is required to request this resource.",
"type": "OAuthException",
"code": 104
}
}
Facebook可能会请求access_token,以便他们可以对此通话进行速率限制。它不需要是用户access_token
,至少是应用访问级别access_token
。请阅读此处的差异:https://developers.facebook.com/docs/concepts/login/access-tokens-and-types/