【发布时间】:2012-03-07 17:30:54
【问题描述】:
所以我有一个 Facebook 页面(我们称之为 X),上面有应用程序 Y。用户可以通过 Y 提出问题,并以用户(而不是应用)的身份发布到 X。
我对该应用的权限当前设置为 publish_stream。
我可以通过
获取令牌 $token_url = "https://graph.facebook.com/oauth/access_token?" .
"client_id=" . $this -> data["environment"] -> fb_appid .
"&client_secret=" . $this -> data["environment"] -> fb_appsecret .
"&grant_type=client_credentials";
$app_token = file_get_contents($token_url);
这给了我一个令牌就好了。
现在,如果我尝试通过 APi 调用 POST,我会得到两个结果:
当我不传递令牌并简单地调用时
$post_id = $this ->Facebook->fb_api("/PAGE_ID/feed", "POST", array("message"=>"This is a post from PHP."));
我收到了 JSON 格式的回复
{
"id": "PAGEID_someOtherID"
}
但我没有看到墙上的帖子。
当我传递访问令牌时,唉
$post_id = $this ->Facebook->fb_api("/PAGE_ID/feed", "POST", array("access_token"=>$app_token,"message"=>"This is a post from PHP."));
我的回复是空的。
这么简单的概念我做错了什么?
【问题讨论】:
标签: php facebook-graph-api post feed facebook-wall