Facebook post wirth php error:(#200)用户还没有授权应用程序执行此操作
问题描述:
我想从我的网站发布到我的脸书网站。我为我的网站创建了一个应用程序。我用这个代码(我用我的应用程序中的数据替换'[]'):Facebook post wirth php error:(#200)用户还没有授权应用程序执行此操作
require_once 'lib/php-graph-sdk-5.4/src/Facebook/autoload.php';
// initialize Facebook class using your own Facebook App credentials
// see: https://developers.facebook.com/docs/php/gettingstarted/#install
$access_token = '[aaccesstoken]';
$config = array();
$config['app_id'] = '[appid]';
$config['app_secret'] = '[appsecret]';
$config['fileUpload'] = false; // optional
$fb = new \Facebook\Facebook($config);
// define your POST parameters (replace with your own values)
$params = array(
"access_token" => $access_token, // see: https://developers.facebook.com/docs/facebook-login/access-tokens/
"message" => "Test Message",
"link" => "http://www.frauen-styles.de",
"picture" => "http://www.frauen-styles.de/site/assets/files/3545/20.jpg",
"name" => "Test Name",
"caption" => "Caption",
"description" => "Beschreibung"
);
// post to Facebook
// see: https://developers.facebook.com/docs/reference/php/facebook-api/
try {
$ret = $fb->post('/me/feed', $params);
echo 'Successfully posted to Facebook';
} catch(Exception $e) {
echo $e->getMessage();
}
我做错了什么?即时通讯管理员页面。支持告诉我,管理员的应用程序不需要publish_pages。我只想从我的网站发送一篇文章到我的脸书页面。
答
support tells me that no publish_pages is requiered
正如你可以在官方文档的API参考阅读,你确实需要publish_pages
和manage_pages
张贴到页面(如页)。
Docs:https://developers.facebook.com/docs/graph-api/reference/page/feed#publish
嗨,你能解决它吗? – Eduardo