We learn more by looking for the answer to a question and not finding it than we do from learning the answer itself.

3 Steps to Use Facebook Connect

Step 1 : Login to Facebook to Create a Facebook Application

First login to Facebook and goto the url http://www.facebook.com/developers/ then Click on “+ Set Up New Application” button to start creating the application as shown below.

Provide the application name, click agree for facebook terms and click on “Create Application” button.

Once the Application is created. Just copy the Application API Key, Application Secret and Application ID details which will be used to write the application code.

Provide the Name and Description of your application in About Section.

Step 2 : Download the Facebook PHP Library

In order to download the latest PHP Libarary, use the following URL : https://github.com/facebook/php-sdk/

Step 3 : Generate one time session key (permanent session key) and Showing how Connect Works


 '117743971608120',
'secret' => '943716006e74d9b9283d4d5d8ab93204',
'cookie' => true,
));
$session = $facebook->getSession();
$me = null;
// Session based API call.
if ($session) {
try {
$uid = $facebook->getUser();
$me = $facebook->api('/me');
} catch (FacebookApiException $e) {
error_log($e);
}
}
// login or logout url will be needed depending on current user state.
if ($me) {
$logoutUrl = $facebook->getLogoutUrl();
} else {
$loginUrl = $facebook->getLoginUrl();
}
// This call will always work since we are fetching public data.
$naitik = $facebook->api('/naitik');
?>








php-sdk

Using JavaScript & XFBML:
Without using JavaScript & XFBML:

Session

You


Your User Object


You are not Connected.

Naitik




Leave a Comment

blog comments powered by Disqus