Facebook API如何获取用户页面

Die*_*oP. 3 api facebook

我使用以下代码来获取Facebook用户的信息.

有没有办法让用户页面(如果用户有一个或多个Facebook页面)和这些页面的ID?

$user = $_POST['uid']; //the returned user ID from Facebook
$key  = $_POST['usid']; //the returned session ID from Facebook
$accesstoken = $_POST['accesstoken']; //the returned accesstoken from Facebook
$image = "http://graph.facebook.com/" .$user ."/picture?type=large"; //Facebook Profile Picture
$name = json_decode(file_get_contents('https://graph.facebook.com/' . $user))->name; //Name of the user account on Facebook
$link = json_decode(file_get_contents('https://graph.facebook.com/' . $user))->link; //Link of the user profile on Facebook
$gender = json_decode(file_get_contents('https://graph.facebook.com/' . $user))->gender; //Gender of the user on Facebook
$locale = json_decode(file_get_contents('https://graph.facebook.com/' . $user))->locale; //Location of the user on Facebook
$url = "https://graph.facebook.com/". $user ."/feed?limit=1&access_token=".$accesstoken; //We get the latest status update on the Facebook Wall
$json = file_get_contents($url);
$jsonData = json_decode($json);
foreach($jsonData->data as $val) {
if($val->from->id == $user) {
$statusmessage = $val->message; //Finally we got the latest status update if there is one on The Facebook Wall
break;
}
}
Run Code Online (Sandbox Code Playgroud)

jBi*_*Bit 5

如果您根据他们的Facebook ID询问如何获得单个用户的其他用户个人资料:答案是您不能.Facebook要求每个用户使用一个配置文件.而在现实生活中,用户可以拥有多个配置文件,但没有可靠的方法从图中提取数据.

但是,如果您询问如何获取用户管理员的页面ID,则使用:

https://graph.facebook.com/USER_ID/accounts
Run Code Online (Sandbox Code Playgroud)

这将需要给定用户的有效访问令牌.