使用twitter oauthclient库登录codeigniter

时间:2013-10-08 12:51:42

标签: php codeigniter twitter

我正在使用oauthclient将twitter登录添加到我的codeigniter项目中,但它停止在“Oauthclient”库的“connect”功能中工作,我不知道具体原因! 这是翻译停在的地方:

                $oauth = new OAuth($this->consumerKey, $this->consumerSecret);

这是“连接”功能:

 function connect() {

    if ($this->_oAuthVersion == 1) {

        try {

            $oauth = new OAuth($this->consumerKey, $this->consumerSecret);

            $request_token_info = $oauth->getRequestToken($this->_oAuthRequestTokenUrl, $this->responseUrl);
            if(!empty($request_token_info)) {
                $this->ci->session->set_userdata("oauth_token_secret", $request_token_info['oauth_token_secret']);
                header("Location: ".$this->_oAuthRedirectUrl.$request_token_info['oauth_token']);
            } else {
                print "Failed fetching request token, response was: " . $oauth->getLastResponse();
            }
        } catch(OAuthException $E) {
            // TODO: Handle exceptions in a better way
            // print_r($E);
            // echo "Response (RequestToken): ". $E->lastResponse . "\n";
        }
    } else {
        // If oAuth v2, we must be sure the url's are correctly poppulated
        // therefor, set the service type again
        $this->setService($this->serviceType);
        header("Location: ".$this->_oAuthRedirectUrl);
    }
}

我需要你的帮助。

0 个答案:

没有答案