title: Twitter OAuth connects via localhost, fails on live version?
body: <p>It seems to be a problem with <code>redirect.php</code> not grabbing the access token properly. I've browsed around and found that lots of people have this problem but I can't figure out how to resolve it. This same code works on localhost but fails on my live version. Any ideas why/how to fix it? Is there a way I can manually set these?</p>
  
  <pre><code>&lt;?php
  
  /* Start session and load library. */
  session_start();
  require_once('twitteroauth/twitteroauth.php');
  require_once('config.php');
  
  /* Build TwitterOAuth object with client credentials. */
  $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET);
  
  /* Get temporary credentials. */
  $request_token = $connection-&gt;getRequestToken(OAUTH_CALLBACK);
  
  /* Save temporary credentials to session. */
  $_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
  $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
  
  /* If last connection failed don't display authorization link. */
  switch ($connection-&gt;http_code) {
    case 200:
      /* Build authorize URL and redirect user to Twitter. */
      $url = $connection-&gt;getAuthorizeURL($token);
      header('Location: ' . $url); 
      break;
    default:
      /* Show notification if something went wrong. */
      echo 'Could not connect to Twitter. Refresh the page or try again later.';
  }
  </code></pre>