Redirecting to my Website is not working

web
php

#1

Twitter Api is not working, while it is already working, now it stops redirecting. whats the problems is? is there change which i have to make in code? after getting token it goes to twitter and after login it is not coming back?
and this is my url https://api.twitter.com/oauth/authenticate?oauth_token=“here is token given”


if(isset($_GET[‘oauth_token’]))
{

        $connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $_SESSION['request_token'], $_SESSION['request_token_secret']);
        $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
        if($access_token)
        {
                $connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
                $params =array();
                $params['include_entities']='false';
                $content = $connection->get('account/verify_credentials',$params);
                print_r($content);
                if($content && isset($content->screen_name) && isset($content->name))
                {
                    $_SESSION['fname']=$content->name;
                    $_SESSION['image']=$content->profile_image_url;
                    $_SESSION['twitter_id']=$content->screen_name;
                    //redirect to main page.
                    header('Location:twitter-login.php');
                    exit(); 
                }
                else
                {
                    echo "<h4>Login Errorsss</h4>";
                }
        }
    
    else
    {
    
        echo "<h4> Login Error</h4>";
    }
    
    }
    else //Error. redirect to Login Page.
    {
        header('Location: https://www.myweb.com/login.php'); 
    
    }

#2

Are you able to share any code example?


#3

if(isset($_GET[‘oauth_token’]))
{

        $connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $_SESSION['request_token'], $_SESSION['request_token_secret']);
        $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
        if($access_token)
        {
                $connection = new TwitterOAuth($CONSUMER_KEY, $CONSUMER_SECRET, $access_token['oauth_token'], $access_token['oauth_token_secret']);
                $params =array();
                $params['include_entities']='false';
                $content = $connection->get('account/verify_credentials',$params);
                print_r($content);
                if($content && isset($content->screen_name) && isset($content->name))
                {
                    $_SESSION['fname']=$content->name;
                    $_SESSION['image']=$content->profile_image_url;
                    $_SESSION['twitter_id']=$content->screen_name;
                    //redirect to main page.
                    header('Location:twitter-login.php');
                    exit(); 
                }
                else
                {
                    echo "<h4>Login Errorsss</h4>";
                }
        }
    
    else
    {
    
        echo "<h4> Login Error</h4>";
    }
    
    }
    else //Error. redirect to Login Page.
    {
        header('Location: https://www.itsmodelcitizen.com/login.php'); 
    
    }