-2

I need to find Facebook username from userid.

Tried:

$userid = '100004471603852';
$appid = **********;
$url = "https://graph.facebook.com/{$userid}?access_token={$appid}";
$result = file_get_contents($url);
print_r($result);

This returns Name and User ID. I need username (login id). Could you please assist me how to do that.

Kunwarbir S.
  • 281
  • 1
  • 3
  • 13

1 Answers1

4

me/username is no longer available.

Source: https://developers.facebook.com/docs/apps/changelog#v2_0

You are not supposed to use the username anymore, just use the App Scoped User ID to identify users.

andyrandy
  • 72,880
  • 8
  • 113
  • 130