The doc wiki has PHP examples for most common calls, including the one you're looking for.
http://wiki.developers.facebook.com/index.php/Users.getInfo#Example%5FRequests
Frank Farmer
2009-12-29 23:49:07
The doc wiki has PHP examples for most common calls, including the one you're looking for.
http://wiki.developers.facebook.com/index.php/Users.getInfo#Example%5FRequests
All you need to do is add the following line to your code:
$userInfo = $facebook->api_client->users_getInfo($user_id, array('name'));
$name = $userInfo[0]['name'];
This is the same as calling the following FQL query (recommended if you are familiar with SQL as Facebook likes to change a lot of their API from time to time):
$facebook->api_client->fql_query("SELECT name FROM user WHERE uid='$user_id'");