This post explains you about How to Create Facebook Application Using PHP and Retrieve User Information.

 

Download Link   Demo Link

 

So here are the simple steps to Create Facebook Application Using PHP and Retrieve User Information.

  • Go to https://developers.facebook.com/apps
  • Click to Create New App button
  • Enter App Name and App Namespace, and leave web hosting checkbox

    How To Create Facebook App with PHP

    How To Create Facebook App with PHP

  • Enter captcha form
  • Now submit basic information about app.

    How To Create Facebook App with PHP

    Click to Save Changes and if everything fine you got this screen.How To Create Facebook App with PHP

  • In this example http://apps.facebook.com/fbweblessons is my app id url.

Now facebook work is complete and time to go for some configuration changes in php files.

  • Just go to facebook folder.
  • Open fbmain.php and change $fbconfig variables information according to your app details, that available in your app setting page.
  • Now create a index.php file and put this code into that file.
<?php
include('facebook/fbmain.php');
if ($user){
     try{
    $fql= "select username,email ,name,pic_big,birthday,sex,
           hometown_location,relationship_status,current_location
           FROM user WHERE uid =".$user;
    $param = array(
            'method' => 'fql.query',
            'query' => $fql,
           'callback' => ''
    );
  $fqlResult = $facebook->api($param);
 }
    catch(Exception $o){
       d($o);
    }
}
$username= $fqlResult[0]['username'];
$name= $fqlResult[0]['name'];
$pic_square= $fqlResult[0]['pic_big'];
$birthday= $fqlResult[0]['birthday'];
$sex= $fqlResult[0]['sex'];
$email = $fqlResult[0]['email'];
?>
Now go to your app url and your first facebook app waiting for you..!!

Note:-  For more information about FQl query ie:- Facebook Query Language check  http://developers.facebook.com/docs/reference/fql/