我有一个有效且经过身份验证的用户,但是当从我们的PHP web应用程序发布到他们的墙时,它返回:
致命错误:Uncaught oauthexcexception:(#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认为这个用户不存在吗?
我有这个问题,后来我意识到我在我的数据库中保存uid作为integer
,然而,新的facebook个人资料有很长的uid,例如:100004409446248
,这不是我可以保存为我的mysql数据库中的integer
的值,我把它改为将其视为varchar
,所以现在没有问题
使用最新API获取Facebook好友列表建议
$friends = $facebook->api('/me/friends');
我为get整数查询字符串编写了两个库例程。与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;
}
将APP ID定义为整数,而不是字符串!