Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/248.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 致命错误:未捕获异常';Abraham\TwitterOAuth\TwitterOAutheException';带有消息';处理您的文件时出错_Php_Twitter_Twitter Oauth - Fatal编程技术网

Php 致命错误:未捕获异常';Abraham\TwitterOAuth\TwitterOAutheException';带有消息';处理您的文件时出错

Php 致命错误:未捕获异常';Abraham\TwitterOAuth\TwitterOAutheException';带有消息';处理您的文件时出错,php,twitter,twitter-oauth,Php,Twitter,Twitter Oauth,使用twitteroauth()SDK创建twitter登录 这是我正在使用的代码 <?php ob_start(); session_start(); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); require 'twitteroauth/autoload.php'; use Abraham

使用twitteroauth()SDK创建twitter登录

这是我正在使用的代码

<?php
    ob_start();
    session_start();
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);


    require 'twitteroauth/autoload.php';
    use Abraham\TwitterOAuth\TwitterOAuth;

    define('CONSUMER_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxx');
    define('CONSUMER_SECRET', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
    define('OAUTH_CALLBACK', getenv('http://istshrna.com/dokholtatbik.php'));


    echo "<meta charset='utf-8' />";

    if(isset($_REQUEST['oauth_verifier'])){

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

        $_SESSION['oauth_token'] = $request_token['oauth_token'];
        $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];

        $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);


        $access_token = $connection->oauth("oauth/access_token", array("oauth_verifier" => $_REQUEST['oauth_verifier']));
        $_SESSION['access_token'] = $access_token;
        $content = $access_token->oauth('account/verify_credentials');

        $data = array();
        if( !empty( $content->id )){
            $data['id'] = $content->id;
            $data['name'] = $content->name;
            $data['screen_name'] = $content->screen_name;
            $data['picture'] = $content->profile_image_url;
            try {
                $user_obj->twitter_login($data);
            }catch (Exception $e) {
                $error = $e->getMessage();
            }

        }else{
            session_unset();
            session_destroy();
            //header('Location: index.php');
        }



    }else{

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

        $_SESSION['oauth_token'] = $request_token['oauth_token'];
        $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];

        $url = $connection->url('oauth/authorize', array('oauth_token' => $request_token['oauth_token']));

        header("location: $url");



    }

    ?>

也有同样的问题。有人能帮忙吗?