1

我用 php api 构建了一个 facebook 应用程序,当我需要在用户的墙上公开一条消息时,一切正常,只是有一个问题。

我的代码如下

$appapikey = "xxxxxx";
$appsecret = "xxxxxx";
$facebook = new Facebook($appapikey, $appsecret);
$fb_user = $facebook->require_login();
if (!$facebook->api_client->users_hasAppPermission("publish_stream, status_update")){
    echo '<fb:prompt-permission perms="publish_stream, status_update">Click here to grant permissions to update your status and publish to your stream.</fb:prompt-permission>';

    try {
        $facebook->api_client->stream_publish($message);
    } catch (Exception $e) {
        echo "Public error".$e->getMessage();
    }
}

我已经允许 publish_stream 的权限,但仍然出现错误

Uncaught exception 'FacebookRestClientException' with message 'Unauthorized source IP address (ip was: 69.89.31.xxx)'
Stack trace:
#0 /home/flexvnne/public_html/facebook/facebook/client/facebookapi_php5_restlib.php(345): FacebookRestClient->call_method('facebook.users....', Array)
#1 /home/flexvnne/public_html/facebook/index.php(36): FacebookRestClient->users_getInfo('625757897', 'username')
#2 {main}
  thrown in /home/flexvnne/public_html/facebook/facebook/client/facebookapi_php5_restlib.php on line 1314
[16-Oct-2009 01:30:53] PHP Fatal error:  Uncaught exception 'FacebookRestClientException' with message 'Unauthorized source IP address (ip was: 69.89.31.xxx)' in /home/flexvnne/public_html/facebook/facebook/client/facebookapi_php5_restlib.php:1314

任何已知的方法来解决这个问题?

4

1 回答 1

0

看起来您的 users_getInfo() 调用在这里失败了,而不是流发布。我的猜测是在您的 facebook 开发者应用程序设置中检查您的白名单/黑名单——您的 IP 可能会受到限制。

于 2009-12-08T18:42:40.380 回答