Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

This is for mmatakedown.net home page

I can't seem to successfully complete the oauth process to retrieve the user id of the twitter account. This began when twitter api was deprecated, I believe.

This is part of my getTwitterData.php file:

    require("twitter/twitteroauth.php");
    require 'config/twconfig.php';
    require 'config/functions.php';
    session_start();
    if (!empty($_GET['oauth_verifier']) && !empty($_SESSION['oauth_token']) &&         !empty($_SESSION['oauth_token_secret'])) {
    // We've got everything we need
    $twitteroauth = new TwitterOAuth(YOUR_CONSUMER_KEY, YOUR_CONSUMER_SECRET, $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
    // Let's request the access token
    $access_token = $twitteroauth->getAccessToken($_GET['oauth_verifier']);
$_SESSION['oauth_verifier']=$_GET['oauth_verifier'];
$oav=$_SESSION['oauth_verifier'];
$_SESSION['twitteroauth']=$twitteroauth;
    // Save it in a session var
    $_SESSION['access_token'] = $access_token;
$ot=$access_token['oauth_token'];
$ots=$access_token['oauth_token_secret'];
$_SESSION['oauth_token']=$ot;
$_SESSION['oauth_token_secret']=$ots;
    // Let's get the user's info
    $user_info = $twitteroauth->get('account/verify_credentials');
    // Print user's info
    //    echo '<pre>';
    //   print_r($user_info);
    //  echo '</pre><br/>';
    if (isset($user_info->error)) {
    // Something's wrong, go back to square 1  
    header('Location: login-twitter.php');
    } else {
    $uid = $user_info->id;
    $username = $user_info->screen_name;

    $user = new User();
    $userdata = $user->checkUser($uid, 'twitter', $username, $email, $ot, $ots);

checkUser is a function requiring the uid but the uid is not being passed. What am I missing?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.