开发者

Public stream to facebook's user wall with php?

开发者 https://www.devze.com 2022-12-13 05:20 出处:网络
I build a facebook app with php api, everything work fine just have a problem when i need public a message on user\'s Wall.

I build a facebook app with php api, everything work fine just have a problem when i need public a message on user's Wall.

my code bellow

$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();
    }
}

I had allow Permission for publish_stream but still get error

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(34开发者_StackOverflow社区5): 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

Anyone known way to solved that problem ?


It looks like your users_getInfo() call is the one that is failing here, not stream publishing. My guess is check your whitelist/blacklist in your facebook developer application app settings -- your IP might be restricted.

0

精彩评论

暂无评论...
验证码 换一张
取 消