https://www.facebook.com/profile.php?id=100010558444183
I want to get this profile id when user login with Facebook.
I tried with this but it gives something else.
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']; ```
You cannot get the "real" id anymore, only an App Scoped ID that is unique and can still be used for identifying returning users. If you want to get a link to the user profile, use the link
field: https://developers.facebook.com/docs/graph-api/reference/v3.2/user
For example:
$response = $fb->get('/me?fields=name,link', $access_token);
More details: https://github.com/facebook/php-graph-sdk/blob/5.x/docs/examples/retrieve_user_profile.md
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.