Val*_*ina 4 php facebook-graph-api facebook-php-sdk
想象一下当我以facebookA身份登录facebook web应用程序时的情况.我知道userB的昵称,但他不在我的朋友列表中,我不知道他的身份.当然,他不使用我的应用程序.
有任何特定权限吗?可能有我错过的手册页?
在v1.0中,以下是可能的:
http://graph.facebook.com/v1.0/{user-name}
但是,对于v2.0和v2.1,无法通过未连接到应用程序的ID或用户名访问用户.例如,尝试http://graph.facebook.com/v2.1/{user-name}将抛出一个错误:
{
"error": {
"message": "(#803) Cannot query users by their username (user-name)",
"type": "OAuthException",
"code": 803
}
}
Run Code Online (Sandbox Code Playgroud)
使用新的PHP SDK(v4.0.x),您可以执行以下操作:
$response = (new FacebookRequest( $session, 'GET', '{user-name}', array(), 'v1.0' ))->execute()->getGraphObject()->asArray();
Run Code Online (Sandbox Code Playgroud)