<?php require $_SERVER['DOCUMENT_ROOT'] . '/ts2/config/consts.php'; require DOCUMENT_ROOT . 'classes/LoginHelper.php'; session_start(); $loginHelper = new LoginHelper(); if ($loginHelper->IsLoggedIn()) { header('Location: ' . SITE_URL); exit; } $loginHelper->suppressRegistration(OAUTH_TWITTER); require 'config/consumer.php'; require 'config/login.php'; require 'Twitter/Twitter.php'; $twitter = new Twitter(CONSUMER_KEY, CONSUMER_SECRET, REDIRECT_URI); header("Location: " . $twitter->getLoginURL()); exit; /* $temp_credentials = $connection->getRequestToken( REDIRECT_URI ); $_SESSION['oauth_token'] = $token = $temp_credentials['oauth_token']; $_SESSION['oauth_token_secret'] = $temp_credentials['oauth_token_secret']; header( "Location: " . $connection->getAuthorizeURL($token) ); exit; */
// We don't yet have access. Let's see if we can get it. if (isset($_GET['denied'])) { echo 'The user has denied access to your application.'; } else { // Check to see if we can get an access token. if ($access = $twitter->getAccessToken()) { $_SESSION['access'] = serialize($access); header("Location: " . $twitter->getOAuthCallback(), true, 301); die('<a href="' . $twitter->getOAuthCallback() . '">Complete Login</a>'); } else { // Unable to get access token. We'll settle for a request token instead. $request = $twitter->getRequestToken(); if ($request) { $_SESSION['request'] = serialize($request); // Display or redirect to user to their login URL. echo '<a href="' . $twitter->getLoginURL() . '">' . $twitter->getLoginURL() . '</a>'; } else { // Problems. echo 'Unable to get request token.'; } } } } else { // The user has authorized access to the application. // Get the current user. $user = $twitter->getUser(); /** * The above call is the same as doing the following: * * $result = $twitter->api("1.1/account/verify_credentials.json"); * if($result->statusCode() == 200)