1
votes

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.

1

1 Answers

4
votes

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.