为什么facebook API返回不正确的响应?

时间:2014-05-21 14:18:17

标签: php facebook facebook-graph-api

我正在使用facebook API在帖子上发表评论,评论已成功发布。但作为回应,facebook返回:

An unexpected error has occurred. Please retry your request later.

当我查看帖子时,评论会被发布。 这是我的代码sinppet:

 $post_id = $_POST['post_id'];
    $user_comment = $_POST['user_comment'];
    $user_information = UserSocials::model()->findByAttributes(array('user_id' => Yii::app()->user->id));
    $access_token = $user_information->fb_access_token;

    $app_id = 'xxx';
    $app_secret = 'yyy';

    Yii::import("application.extensions.facebooksdk.Facebook");
    $config = array();
    $config['appId'] = $app_id;

    $config['secret'] = $app_secret;

    $config['fileUpload'] = false; // optional
    $facebook = new Facebook($config);


    $result=$facebook->api('/' . $post_id . '/comments', 'post', array(
        'access_token' => $access_token,
        'message' => 'Your message',
            )
    );

    print_r($result);

我必须得到成功或失败的回复,因为我必须提示用户评论是否已发布。 谁能告诉我哪里出错?

0 个答案:

没有答案