Facebook PHP 抛出异常“(#803) 您请求的某些别名不存在”
我有一个有效且经过身份验证的用户,但是当从我们的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我编写了两个库例程来获取整数查询字符串。与 Dainel 在使用
intval()
函数时的经历类似,我收到无效的 Facebook ID,导致产生该错误。代码:
我使用 get_str 作为 facebook_id,问题就消失了。
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:
I use the get_str for facebook_id and problem was gone.
将 APP ID 定义为整数,而不是字符串!
Define APP ID as integer, not string!
我遇到了这个问题,后来我意识到我将 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 aninteger
in my mysql database, I changed this to treat it as avarchar
, so now there's no issue这个问题使用最新API获取Facebook好友列表建议
<代码>$friends = $facebook->api('/me/friends');
This question Getting list of Facebook friends with latest API suggests
$friends = $facebook->api('/me/friends');