Skip to content

Instantly share code, notes, and snippets.

@richardpilgrim
Last active December 24, 2015 17:59
Show Gist options
  • Save richardpilgrim/6839668 to your computer and use it in GitHub Desktop.
Save richardpilgrim/6839668 to your computer and use it in GitHub Desktop.
Facebook PHP Example Logout Code
<?php
require '../src/facebook.php';
// Create our Application instance (replace this with your appId and secret).
$facebook = new Facebook(array(
'appId' => '<appid>',
'secret' => '<appsecret>',
));
$user = $facebook->getUser();
//Check if user exists
if($user)
{
$params = array( 'next' => 'logout.php' );
$logoutUrl = $facebook->getLogoutUrl();
}
else
{
session_destroy();
header("Location: example.php");
die();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment