Skip to content

Instantly share code, notes, and snippets.

@jhaynie
Created December 11, 2009 23:25
Show Gist options
  • Save jhaynie/254601 to your computer and use it in GitHub Desktop.
Save jhaynie/254601 to your computer and use it in GitHub Desktop.
<?include_once 'facebook.php';
////////////////////////////////////////////////////////////////////////////////
// Put your app info here.
////////////////////////////////////////////////////////////////////////////////
$APP_INFO = array('api_key' => 'YOUR API KEY',
'secret' => 'YOUR API SECRET');
// grab the auth_token and generate_session_secret GET values. the Facebook
// PHP lib does some magic with these, so unset them to hide them from the lib.
// client libraries in other languages probably don't have this problem.
$auth_token = $_GET['auth_token'];
$generate_ss = $_GET['generate_session_secret'];
$format = $_GET['format'];
unset($_GET['auth_token']);
unset($_GET['generate_session_secret']);
unset($_GET['format']);
// initialize the Facebook lib
$fb = new Facebook($APP_INFO['api_key'],
$APP_INFO['secret'],
$generate_ss);
//TITANIUM NOTE - make sure you have the correct content-type
header("Content-type: text/" . $format);
// the PHP lib also does some magic with cookies, so clear them
$fb->clear_cookie_state();
// set the format based on what's requested
//TITANIUM NOTE - pass in format based on parameter passed in as GET
$fb->api_client->setFormat(strtoupper($format));
// make the auth.getSession call
$session_vars = $fb->api_client->auth_getSession($auth_token, $generate_ss);
// print the raw response
echo $fb->api_client->getRawData();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment