glynco
asked on
Facebook Php Logout
I have this logout but it only logs out on facebook not on my site.
$logoutUrl=$_SESSION['logout'];
Eh? Is there anything else you want to tell us?
ASKER
I need a redirect to my logout.php after being log out on facebook.
There are two ways you can redirect the client browser. One is with the header() function. The other is to put a meta-refresh tag into the browser output stream. The latter method is "deprecated" however I have never encountered a browser that did not obey the command.
See these links for specifics:
http://php.net/manual/en/function.header.php
http://en.wikipedia.org/wiki/Meta_refresh
See these links for specifics:
http://php.net/manual/en/function.header.php
http://en.wikipedia.org/wiki/Meta_refresh
ASKER
What I mean is I have to redirect after logging out on facebook.com
I tried this but it does not work
I tried this but it does not work
$facebook->getLogoutUrl( array(
'redirect_uri' => 'http://www.mydomain.com/fblogout.php')
);
ASKER
---------------------
home.php
-----------------
fbconfig.php
home.php
require 'facebook.php';
require 'fbconfig.php';
session_start();
$facebook=$_SESSION['facebook'];
$userdata=$_SESSION['userdata'];
$logoutUrl=$_SESSION['logout'];
//$logoutUrl = $facebook->getLogoutUrl(array('next' => $logoutUrl, 'session_key' => $session_key));
//$logoutUrl = $facebook->getLogoutUrl( array(
// 'redirect_uri' => 'http://www2.mydomain.com/fblogout.php')
//);
-----------------
fbconfig.php
<?php
$facebook_appid='xxxxx';
$facebook_app_secret='xxxxx';
$facebook = new Facebook(array(
'appId' => $facebook_appid,
'secret' => $facebook_app_secret,
));
?>
You can specify in your facebook app setting what you want the return URL to be.
ASKER
Where is that? I cannot find it on settings
instead of this,
$facebook->getLogoutUrl( array(
'redirect_uri' => 'http://www.mydomain.com/fblogout.php')
);
try,
echo "<script>window.location = 'http://www.mydomain.com/fblogout.php'</script>";
$facebook->getLogoutUrl( array(
'redirect_uri' => 'http://www.mydomain.com/fblogout.php')
);
try,
echo "<script>window.location = 'http://www.mydomain.com/fblogout.php'</script>";
ASKER
I need to log-out on both facebook website and on my site.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
If I send them to my logout page first, how can I send them to facebook page if the session has already been destroyed?