Facebook页面墙我试图张贴到使用卷曲我的Facebook页面墙上,但我不断收到以下错误发布通过卷曲
The user hasn't authorized the application to perform this action
如何生成使用curl正确的访问令牌?如果你去这个网址http://developers.facebook.com/tools/explorer/
然后我可以把下面的https://graph.facebook.com/337588736279406/feed,这将显示出我的墙饲料的话,我可以改变这个发布和添加一个字段的信息内容,如果我再运行此我得到以下响应。
{
"error": {
"message": "(#200) The user hasn't authorised the application to perform this action",
"type": "OAuthException",
"code": 200
}
}
我必须做什么来授权我作为用户?
有人可以帮助我做到这一点。
<?php
function postify($arr) {
$fields_string = '';
foreach ($arr as $key => $value) {
$fields_string .= $key . '=' . $value . '&';
}
return rtrim($fields_string, '&');
}
$appid = 'app id';
$redirect_url = 'http://stickynote.users36.interdns.co.uk';
$app_secret = 'app secret';
$page_id = '337588736279406';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id='.$appid.'&redirect_uri='.$redirect_url.'&client_secret='.$app_secret.'&perms=publish_stream');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
$output = explode("=", $output);
curl_close($ch);
$postdata = array(
'message' => 'this is a test message',
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://graph.facebook.com/'.$page_id.'/feed?access_token='.$output[1].'');
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, postify($postdata));
$check = curl_exec($ch);
print_r($check);
?>
我该如何做到这一点可以帮助 – DCHP 2012-02-23 16:40:21
我已经发布了我的完整代码 – DCHP 2012-02-23 16:43:12
嗨多汁感谢回复我很高兴困惑我如何通过卷发返回访问令牌我可以运行你说的http:// www。 facebook.com/dialog/oauth/?scope=email,user_birthday,publish_stream&client_id=277938122277013&redirect_uri=http://stickynote.users36.interdns.co.uk&response_type=token这会返回我的url中的代码,然后我如何访问这通过curl – DCHP 2012-02-23 16:54:53