如何在facebook php sdk中获取用户个人资料ID

问题描述 投票:-2回答:1

https://www.facebook.com/profile.php?id=100010558444183我想在用户使用Facebook登录时获取此个人资料ID。

我试过这个,但它给了别的东西。

try {
  // Returns a `Facebook\FacebookResponse` object
  $response = $fb->get('/me',$access_token);
} catch(Facebook\Exceptions\FacebookResponseException $e) {
  echo 'Graph returned an error: ' . $e->getMessage();
  exit;
} catch(Facebook\Exceptions\FacebookSDKException $e) {
  echo 'Facebook SDK returned an error: ' . $e->getMessage();
  exit;
}



$user = $response->getGraphUser();

$id =  $user['id']; ```


php facebook facebook-php-sdk userid
1个回答
0
投票

您不能再获得“真实”ID,只有App Scoped ID是唯一的,仍可用于识别返回用户。如果要获取用户配置文件的链接,请使用http://www.krishantechnology.com/字段:http://facebook.com/krishb44

例如:

link

更多细节:https://developers.facebook.com/docs/graph-api/reference/v3.2/user

© www.soinside.com 2019 - 2024. All rights reserved.