我正在研究facebook post功能,因为我使用的是facebook php sdk,但是它给了我错误,例如"(#200)用户没有授权应用程序执行此操作" ,有谁能告诉我这个问题是什么?
这是我的代码:
<?php
require '../src/facebook.php';
// initialize Facebook class using your own Facebook App credentials
// see: https://developers.facebook.com/docs/php/gettingstarted/#install
$config = array();
$config['appId'] = '*****';
$config['secret'] = '*****';
$config['fileUpload'] = false; // optional
$config['scope'] = 'publish_actions';
$config['redirect_uri'] = 'https://www.myapp.com/post_login_page';
$fb = new Facebook($config);
// define your POST parameters (replace with your own values)
$params = array(
"access_token" => "*****", // see: https://developers.facebook.com/docs/facebook-login/access-tokens/
"message" => "This is just testing message",
"link" => "http://www.pontikis.net/blog/auto_post_on_facebook_with_php",
//"picture" => "http://i.imgur.com/lHkOsiH.png",
"name" => "How to Auto Post on Facebook with PHP",
"caption" => "www.pontikis.net",
"description" => "Testing description message"
);
// post to Facebook
// see: https://developers.facebook.com/docs/reference/php/facebook-api/
try {
$ret = $fb->api('/*****/feed', 'POST', $params);
echo 'Successfully posted to Facebook';
} catch(Exception $e) {
echo $e->getMessage();
}
die;