我正试图通过我的网站在facebook上发布帖子。
我有这些权限
'scope' => 'read_stream, email, publish_stream, user_birthday, user_location, user_work_history, user_hometown, user_photos',
但我无法发布帖子。我无法发布以下示例。
if(isset($_POST['publish'])){
try{
$statusUpdate = $facebook->api("/$user/feed", 'post', array(
'message' => 'Message here',
'link' => 'webiste link here',
'picture' => 'image link here',
'name' => 'Heading',
'caption' => 'example.com',
'description' => 'bla bla bla bla',
));
}catch(FacebookApiException $e){
error_log($e);
}
}
但我能成功发布简单的帖子(状态),只留言
if(isset($_POST['status'])){
try{
$statusUpdate = $facebook->api("/$user/feed", 'post', array('message'=> $_POST['status']));
}catch(FacebookApiException $e){
error_log($e);
}
}
任何人都可以告诉我我需要的额外许可或我缺少的内容吗?
使用Graph API我收到此错误
{
"error": {
"message": "(#100) The post's links must direct to the application's connect or canvas URL.",
"type": "OAuthException",
"code": 100
}
}
在error_log.php
我发现了这个
OAuthException:(#100)帖子的链接必须指向应用程序的连接或画布网址。
答案 0 :(得分:1)
要解决错误:(#100) The post's links must direct to the application's connect or canvas URL.
,您必须在应用设置中将“Stream Post Url Security”设置为 false 。
旁注:您不需要user_birthday
和其他人发布Feed。只需要publish_stream
。