1

我正在尝试通过我的网站在 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) 帖子的链接必须指向应用程序的连接或画布 URL。

4

1 回答 1

1

要解决错误:(#100) The post's links must direct to the application's connect or canvas URL.,您必须在应用程序设置中将“Stream Post Url Security”设置为false

旁注:您不需要user_birthday和其他人发布提要。只有publish_stream是必需的。

于 2013-08-02T07:33:00.750 回答