Im using the Twitter OAuth class to connect to Twitter, found here:
Currently, the script uses only tokens, but does not store them in the database, I would like the script to do this.
This is what I have in my script callback:
<?php session_start(); require_once('twitteroauth/twitteroauth.php'); require_once('config.php'); if (isset($_REQUEST['oauth_token']) && $_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) { $_SESSION['oauth_status'] = 'oldtoken'; header('Location: ./clearsessions.php'); } $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']); $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']); $_SESSION['access_token'] = $access_token; unset($_SESSION['oauth_token']); unset($_SESSION['oauth_token_secret']); if (200 == $connection->http_code) { $_SESSION['status'] = 'verified'; header('Location: ./index.php'); } else { header('Location: ./clearsessions.php'); }
How can I save tokens in MySql, in which part of the script will I get tokens?
mysql oauth twitter
Cliown
source share