开发者

Facebook Logout [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_如何学Python Closed 11 years ago.

Hello i am trying to logout using file_get_contents.

Here is my code

<?php echo file_get_contents("http://www.facebook.com/logout.php"); ?>

i am not able to logout From Facebook .

Can AnyBody Help

Thanks


Logging out involves a lot more than doing a simple HTTP request. For one, you need the session id of the user you're trying to log off. When you execute this code, your server is actually the one doing the request, not the user using your system (and logged onto Facebook). So Facebook has no idea who you're trying to logout.

If you really want to do this, you should set up a Curl session, and pass the session id. But easier is, to provide a link to the user. If they go to the URL, their session id is passed automatically.


Add the following to the very beginning of your website page

session_start();

if($_GET['logoutfrmfb']=="logout")
{
   unset($_SESSION['fb_{your app id}_code']);
   unset($_SESSION['fb_{your app id}_access_token']);
   unset($_SESSION['fb_{your app id}_user_id']);
}

Find and edit the following lines in src/base_facebook.php (probably lines 506-515)

  public function getLogoutUrl($params=array()) {
 return $this->getUrl(
   'www',
   'logout.php',
   array_merge(array(
     'next' => $this->getCurrentUrl().'?logoutfrmfb=logout',
     'access_token' => $this->getAccessToken(),
   ), $params)
   );
  }

works for me!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜