I\'ve been searching for hours for the solution to this problem but can\'t find one that works for me. When i click \"Logout\" on my site the user information is still visible a
Because I still have PHP 5.3 at my CentOS 6.7 server in year 2016 and don't want to take the hassle of upgrading the PHP version - I still use the old facebookarchive/facebook-php-sdk instead of the newer facebook/facebook-php-sdk-v4 library.
And here is how I handle the logout in my app:
REPLACE_ME,
'secret' => REPLACE_ME,
));
if (isset($_REQUEST['logout'])) {
$client->destroySession();
header('Location: ' . REDIRECT);
exit(0);
}
if ($client->getUser()) {
try {
$me = $client->api('/me?fields=id,first_name,gender');
$body = '' . print_r($me, TRUE) . '
';
} catch (FacebookApiException $ex) {
error_log($ex);
$body = '' . htmlspecialchars($e->getMessage()) . '
';
}
} else {
$body = sprintf('', $client->getLoginUrl());
}
?>
= TITLE ?>
= $body ?>
Do not forget to -
https://example.com/myapp/
at the same place