getAccessToken($_REQUEST['oauth_verifier']); /* If HTTP response is 200 continue otherwise send to connect page to retry */ if ($connection->http_code == 200) { $access_token = db_escape_string(json_encode($access_token)); db_query($link, "UPDATE ttrss_users SET twitter_oauth = '$access_token' WHERE id = ".$_SESSION['uid']); } else { header('Location: twitter.php?op=clear'); return; } } if ($op == 'register') { /* Build TwitterOAuth object with client credentials. */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); /* Get temporary credentials. */ $request_token = $connection->getRequestToken($callback_url); /* Save temporary credentials to session. */ $_SESSION['oauth_token'] = $token = $request_token['oauth_token']; $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret']; if ($connection->http_code == 200) { $url = $connection->getAuthorizeURL($token); header('Location: ' . $url); return; } } ?>