Facebook Php Logout

I have this logout but it only logs out on facebook not on my site.


Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
Eh?  Is there anything else you want to tell us?
glyncoAuthor Commented:
I need a redirect to my logout.php after being log out on facebook.
Ray PaseurCommented:
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:
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

glyncoAuthor Commented:
What I mean is I have to redirect after logging out on facebook.com

I tried this but it does not work

$facebook->getLogoutUrl( array(
    'redirect_uri'  => 'http://www.mydomain.com/fblogout.php')

Open in new window

glyncoAuthor Commented:

require 'facebook.php';
require 'fbconfig.php';

//$logoutUrl = $facebook->getLogoutUrl(array('next' => $logoutUrl, 'session_key' => $session_key));

//$logoutUrl = $facebook->getLogoutUrl( array(
//    'redirect_uri'  => 'http://www2.mydomain.com/fblogout.php')

Open in new window


$facebook = new Facebook(array(
'appId' => $facebook_appid,
'secret' => $facebook_app_secret,

Open in new window

Ben McNellyCommented:
You can specify in your facebook app setting what you want the return URL to be.
glyncoAuthor Commented:
Where is that? I cannot find it on settings
Loganathan NatarajanLAMP DeveloperCommented:
instead of this,
$facebook->getLogoutUrl( array(
    'redirect_uri'  => 'http://www.mydomain.com/fblogout.php')


echo "<script>window.location = 'http://www.mydomain.com/fblogout.php'</script>";
glyncoAuthor Commented:
I need to log-out on both facebook website and on my site.
Ben McNellyCommented:
Ah, in that case I would make the link go to your logout page, that then redirects or has the facebook logout code in it.

Send user to your log out page
Log out page sends them to facebook log out

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
glyncoAuthor Commented:
If I send them to my logout page first, how can I send them to facebook page if the session has already been destroyed?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.