tags:

views:

67

answers:

2
+1  A: 

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
can i do this by using XFBML? if yes, how?
amit
http://wiki.developers.facebook.com/index.php/Fb:name
Frank Farmer
A: 

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'");

Steven Lu
the FQL does not work. the above 2 statements did the trick.
amit