dongshicuo4844 2015-05-28 07:40
浏览 42

如何在Twitter关闭网络时断开您的应用程序推特

I need to associate my twitter application with my twitter account. In particular I would that when I click log out on my twitter account(https://twitter.com/) I log ou from my app twitter.In the code that I show below the login works but when I log out from my twitter account it doesn't log out from the app so the session is not close. The code is:

 if (!isset($_SESSION["request_token"])) {


    $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
    $request_token = $connection->oauth("oauth/request_token", array("oauth_callback" => OAUTH_CALLBACK));
    if($request_token){


  (NEEDED IN THE NEXT SCRIPT)
    $oauth_token=$request_token['oauth_token'];
    $token_secret=$request_token['oauth_token_secret'];
    $_SESSION['request_token']=$oauth_token;
    $_SESSION['request_token_secret']=$token_secret;
   ;


    $url = $connection->url("oauth/authorize", array("oauth_token" => $oauth_token));

    header('Location: ' . $url);
    }
    }else{

    $connection = new TwitterOAuth(TWITTER_CONSUMER_KEY, TWITTER_CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
        $oauth_verifier = $_SESSION ['oauth_verifier'];
        $token_secret = $_SESSION ['request_token_secret'];
        $oauth_token = $_SESSION ['request_token'];
        $trovato = false;


        $connection = new TwitterOAuth (CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $token_secret );

        $access_token = $connection->oauth("oauth/access_token", 

        $connection = new TwitterOAuth ( CONSUMER_KEY, CONSUMER_SECRET, $access_token ['oauth_token'], $access_token ['oauth_token_secret'] );
        $content = $connection->get ( "account/verify_credentials" );
        if(!empty($content->id)){
            $_SESSION['screen_name']=$content->screen_name;
            header('Location: ....);

        }

The library is : https://github.com/abraham/twitteroauth Who are the parameters that I can use to check my log in?Anyone can help me?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题