Facebook PHP 抛出异常“(#803) 您请求的某些别名不存在”

发布于 2024-11-05 01:12:46 字数 1125 浏览 0 评论 0原文

我有一个有效且经过身份验证的用户,但是当从我们的 PHP Web 应用程序发布到他们的墙上时,它会返回:

致命错误:未捕获的 OAuthException:(#803) 您请求的某些别名不存在:xxxxxxxxxxxxx","name ":"xxxxxxx

我还有 24 个其他用户可以毫无问题地发帖。我可以通过访问 https://graph.facebook.com/xxxxxxxxxxxxx 来查看用户的存在,

这是代码:

    $fb_user_id = $row[0]; // loaded from DB
    $facebook_token = $row[1]; // loaded from DB

    $result = $facebook->api('/' . $fb_user_id. '/feed/',
                                'post',
                                array('access_token' => $facebook_token,
                                    'message' => $postMessage,
                                    'name' => 'Product name',
                                    'caption' => 'Accomplished!',
                                    'link' => 'http://www.xxxxxxx.com/',
                                    'description' => $postMessage,
                                    'picture' => 'http://www.xxxxxxx.com/images/productImage.png'));

有什么想法为什么 Facebook API 认为该用户不存在吗?

I have a valid and authenticated user, but when posting to their wall from our PHP web app it returns:

Fatal error: Uncaught OAuthException: (#803) Some of the aliases you requested do not exist: xxxxxxxxxxxxx","name":"xxxxxxx

I have 24 other users that can post with no issues. And I can see the user exists by going to https://graph.facebook.com/xxxxxxxxxxxxx

Here is the code:

    $fb_user_id = $row[0]; // loaded from DB
    $facebook_token = $row[1]; // loaded from DB

    $result = $facebook->api('/' . $fb_user_id. '/feed/',
                                'post',
                                array('access_token' => $facebook_token,
                                    'message' => $postMessage,
                                    'name' => 'Product name',
                                    'caption' => 'Accomplished!',
                                    'link' => 'http://www.xxxxxxx.com/',
                                    'description' => $postMessage,
                                    'picture' => 'http://www.xxxxxxx.com/images/productImage.png'));

Any ideas why the Facebook API thinks this user does not exist?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

杯别 2024-11-12 01:12:47

我编写了两个库例程来获取整数查询字符串。与 Dainel 在使用 intval() 函数时的经历类似,我收到无效的 Facebook ID,导致产生该错误。

代码:

function get_int($field) {
    $value = 0;
    if(isset($_GET[$field])) $value = intval($_GET[$field]);
    return $value;
}

我使用 get_str 作为 facebook_id,问题就消失了。

function get_str($field) {
    $value = '';
    if(isset($_GET[$field])) $value = $_GET[$field];
    return $value;
}

I wrote two library routine for get integer querystrings. Similar to Dainel's experience when I use the intval() function, I get an invalid Facebook id cause produce that error.

Code:

function get_int($field) {
    $value = 0;
    if(isset($_GET[$field])) $value = intval($_GET[$field]);
    return $value;
}

I use the get_str for facebook_id and problem was gone.

function get_str($field) {
    $value = '';
    if(isset($_GET[$field])) $value = $_GET[$field];
    return $value;
}
怀念你的温柔 2024-11-12 01:12:47

将 APP ID 定义为整数,而不是字符串!

Define APP ID as integer, not string!

梦亿 2024-11-12 01:12:46

我遇到了这个问题,后来我意识到我将 uid 作为整数保存在数据库中,但是,新的 Facebook 个人资料有很长的 uid,例如:100004409446248,这个不是我可以在 mysql 数据库中保存为 integer 的值,我更改了它以将其视为 varchar,所以现在没有问题

I had this issue, later I realised I was saving the uid in my database as an integer, however, new facebook profiles have very long uids, such as : 100004409446248, this was not a value I could save as an integer in my mysql database, I changed this to treat it as a varchar, so now there's no issue

痴者 2024-11-12 01:12:46

这个问题使用最新API获取Facebook好友列表建议

<代码>$friends = $facebook->api('/me/friends');

This question Getting list of Facebook friends with latest API suggests

$friends = $facebook->api('/me/friends');

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文