Php 当我获得LinkedIn的访问令牌时,我得到了401

Php 当我获得LinkedIn的访问令牌时,我得到了401,php,oauth,linkedin,Php,Oauth,Linkedin,$oauth->getAccessToken()导致无效的身份验证/错误请求(获得401,预期为HTTP/1.1 20X或重定向) 我如何查看请求头以找出到底是什么错误 $oauth = new OAuth(CONSUMER_KEY, CONSUMER_SECRET); $oauth->disableSSLChecks(); $request_token_response = $oauth->getRequestToken('https://api.link

$oauth->getAccessToken()导致无效的身份验证/错误请求(获得401,预期为HTTP/1.1 20X或重定向)

我如何查看请求头以找出到底是什么错误

    $oauth = new OAuth(CONSUMER_KEY, CONSUMER_SECRET);

    $oauth->disableSSLChecks();
    $request_token_response = $oauth->getRequestToken('https://api.linkedin.com/uas/oauth/requestToken');

    if($request_token_response === FALSE) {
            throw new Exception("Failed fetching request token, response was: " . $oauth->getLastResponse());
    } else {
        $request_token = $request_token_response;
        var_dump($request_token);

        if (!isset($_GET['oauth_verifier'])) {
            $this->redirect("https://api.linkedin.com/uas/oauth/authorize?oauth_token=" . $request_token['oauth_token']);
        } else {
            $oauth_verifier = $_GET['oauth_verifier'];
            $oauth->setToken($request_token['oauth_token'], $request_token['oauth_token_secret']);

            $access_token_url = 'https://api.linkedin.com/uas/oauth/accessToken';
            $access_token_response = $oauth->getAccessToken($access_token_url, "", $oauth_verifier);

            if($access_token_response === FALSE) {
                    throw new Exception("Failed fetching request token, response was: " . $oauth->getLastResponse());
            } else {
                $access_token = $access_token_response;

                $params = array();
                $headers = array();
                $method = OAUTH_HTTP_METHOD_GET;

                // Specify LinkedIn API endpoint to retrieve your own profile
                $url = "http://api.linkedin.com/v1/people/~";

                // By default, the LinkedIn API responses are in XML format. If you prefer JSON, simply specify the format in your call
                // $url = "http://api.linkedin.com/v1/people/~?format=json";

                // Make call to LinkedIn to retrieve your own profile
                $oauth->fetch($url, $params, $method, $headers);

                echo $oauth->getLastResponse();
            }
        }

    }       
}

oauth_验证器仅验证从中获取请求_令牌。我需要在会话中存储原始请求令牌,而不是在回调时获取新的请求令牌