Facebook Graph API Class Integration

Facebook Graph API Using both PHP and Javascript

The facebook Graph API class can be integrated by using the PHP function along with facebook applicationID and the secret key

Facebook Graph API Integration Code

// Require the class.
require_once 'Facebook.php';

// Create a new instance of Facebook with your ApplicationID and SecretKey.
$Facebook = new Facebook("155715524462317", "73ae58208657e6d9e52d12ad8deff720");

// Get the current status of your Facebook cookie (Will return NULL if not logged in, or authenticated).
$Cookie = $Facebook->catchCookie();
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<title>Facebook Class</title>
// Check the Cookie status.
if($Cookie) {
// If you have been logged in, assign a array containing all basic information to a variable.
$User = $Facebook->getUserInfo($Cookie);

// Print the variable (As a test, I suppose?).
} else {
// The user is either logged out of Facebook, not authenticated to your application, or both. Show the login button :).
echo $Facebook->loginButton();

// This quickly compiles all the Javascript and DIVS needed to run the FacebookAPI (You can do it yourself, but this makes the code look cleaner).

Related Topic Facebook Search for People - Tips
Struts 1 vs Struts2 Difference Performance
Integration Struts with Spring Hibernate J2EE
How to Create Facebook Fan Page
Calculate How Many Times URL have been Shared on Facebook

nScraps.com 2011   Privacy Policy  Terms of Service  Feedback