Hi,
In this post I will be discussing about Graph API. The most basic use of it is when you want the users to register in your website via their Facebook profile. The advantage of doing that is, it saves all the email authentication, captcha etc validations. It simply fetches the users existing details from what is there in Facebook for that user. The use of Graph API is imense, which I hope to cover in my future post. In this I will be just concentrating on letting the users register in a website using the Graph API.
First and the most important thing, is to create your own App in Facebook. This is a very straight forward process, You just need to enter the App name, and URL. An App can be considered as the gateway between your website and Facebook's data.
Follow this link to create a new App. Once you have set up your website you will be given a App ID and secret key. This will be needed in your code. So preserve this information carefully.
Now coming to the code. First
click here to download the code. The main aspect of this code is the facebook.php file. This is the PHP SDK for Facebook Graph.
Explanation:
First you need to initialise the Facebook object by the App ID and secret key which you got in the above steps by:
$facebook = new Facebook(array('appId' => 'YOUR_API_KEY','secret' => 'YOUR_SECRET_KEY','cookie' => true,));