Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function twitter()
- {
- // The TwitterOAuth instance
- $twitteroauth = new TwitterOAuth($this->config->item('key', 'twitter'), $this->config->item('secret', 'twitter'));
- // Requesting authentication tokens, the parameter is the URL we will be redirected to
- $request_token = $twitteroauth->getRequestToken( site_url() . 'auth/twitter_oauth' );
- // Saving them into the session
- $array = array(
- 'oauth_token' => $request_token['oauth_token'],
- 'oauth_token_secret' => $request_token['oauth_token_secret']
- );
- $this->session->set_userdata( $array );
- // If everything goes well..
- if($twitteroauth->http_code==200){
- // Let's generate the URL and redirect
- $url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']);
- header('Location: '. $url);
- } else {
- // It's a bad idea to kill the script, but we've got to know when there's an error.
- die('Something wrong happened.');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement