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
<?php
// 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>
<!-- DONT FORGET TO INCLUDE FBML! -->
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">
<head>
<title>Facebook Class</title>
</head>
<body>
<?php
// 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?).
print_r($User);
} 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).
$Facebook->Compile();
?>
</body>
</html>