When you are developing a facebook app, in many cases u need to know the name of the user. Normally you get it if the user gives the basic permission. But if you don’t want to store the name of the user you just want to store the user ID only and later when you need the Name of the user then you can get that easily and anytime. Below is how you can get it in PHP.
$user_details_encoded = file_get_contents("https://graph.facebook.com/User_ID?fields=name"); $user_details_decoded = json_decode($user_details_encoded,true); $user_name = $user_details_decoded['name'];
$user_name gives you the name of the required user.