Easy A
Would you like to react to this message? Create an account in a few clicks or log in to continue.


 
HomeHome  Latest imagesLatest images  SearchSearch  RegisterRegister  Log inLog in  

Share
 

 Twitter retweet script printing authorize url in browser window and also not redirec

View previous topic View next topic Go down 
AuthorMessage
-Dance-
Member
Member
-Dance-

Posts : 5
Join date : 2011-06-05

Twitter retweet script printing authorize url in browser window and also not redirec Empty
PostSubject: Twitter retweet script printing authorize url in browser window and also not redirec   Twitter retweet script printing authorize url in browser window and also not redirec EmptyFri Jun 17, 2011 9:20 am

Hi

I am not a php coder, just being straight up to begin with.

I have a retweet script(viral tweets 2), when I click the retweet button it prints this: should be at
Code:

https://twitter.com/oauth/authenticate?oauth_token=mavXM2HkYQSm63Uag10Re969X1g63vAcvS9BGcmEU
Here's the process.php file which I think processes the request when someone clicks on the retweet button.
Code:

<?php
session_start();
require_once('twitter/twitteroauth.php');
require_once('twitter/twitterclassic.php');
require_once('viraltweets.php');

//Did You Come From Twitter OAuth?
if(isset($_REQUEST['oauth_token'])):

    //Twitter OAuth Tweet and Follow
    if (isset($_REQUEST['oauth_token']) && $_SESSION['oauth_token'] !== $_REQUEST['oauth_token']) {
      $_SESSION['oauth_status'] = 'oldtoken';
      //header('Location: ./clearsessions.php');
      echo "fail";
    }
   
    /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */
    $connection = new TwitterOAuth($user['twitter_consumer_key'], $user['twitter_consumer_secret'], $_SESSION['oauth_token'], $_SESSION['oauth_token_secret']);
   
    /* Request access tokens from twitter */
    $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']);
   
    /* Save the access tokens. Normally these would be saved in a database for future use. */
    $_SESSION['access_token'] = $access_token;
   
    /* Remove no longer needed request tokens */
    unset($_SESSION['oauth_token']);
    unset($_SESSION['oauth_token_secret']);
   
    /* If HTTP response is 200 continue otherwise send to connect page to retry */
    if (200 == $connection->http_code) :
        /* The user has been verified and the access tokens can be saved for future use */
        $_SESSION['status'] = 'verified';
        //header('Location: ./index.php');
     
        /* Get user access tokens out of the session. */
        $access_token = $_SESSION['access_token'];
       
        /* Create a TwitterOauth object with consumer/user tokens. */
        $connection = new TwitterOAuth($user['twitter_consumer_key'], $user['twitter_consumer_secret'], $access_token['oauth_token'], $access_token['oauth_token_secret']);
       
        /* If method is set change API call made. Test is called by default. */
        $content = $connection->get('account/verify_credentials');
       
        /* Some example calls */
        $connection->post('https://twitter.com/statuses/update.xml', array('status' => $_SESSION['twitter_message']));
       
        if(isset($_SESSION['tid_array']) && is_array($_SESSION['tid_array'])) {
            foreach($_SESSION['tid_array'] as $arr) {
                $connection->post('http://twitter.com/friendships/create.xml', array('screen_name'=>$arr));
            }
        }
       
          /* All done, Now What */
        if(isset($_SESSION['email_destination'])) {
            header("Location: email.php");
        }

        header("Location: ". $_SESSION['twitter_redirect']);   
       
    endif;   

else:

    //Get Twitter RT Message
    $twitter_message = $_POST['twitter_message'];
   
    //Get Twitter Follow List (Session Array)
    $follow_names = $_POST['twitter_autofollow']; //array("kylegraham");
    $redirect = $_POST['twitter_redirect'];
   
    //print_r($_POST);
    //Twitter Classic API
    if(isset($_POST['twitter_username']) && isset($_POST['twitter_password'])) :
        //tweet
        $twitter_message = $_POST['twitter_message']; $msg = str_replace("\'","'",$twitter_message);
        $username = $_POST['twitter_username'];
        $password = $_POST['twitter_password'];
        if($msg!="" && $username!="" && $password!="" && $redirect!="") {   
            $doupdate = updateTwitter($username,$password,$msg);
            if($doupdate) {
                //update tweet stats
                $id = $_POST['campaign_id']; $type = "tweets";
                include("updatestats.php");
                if(isset($_GET['ajax'])) {
                    //what to write if request was an AJAX request
                    echo "success";
                } else {
                    header( "Location: $redirect");
                }
            } else {
                //showError();
                echo $doupdate;
            }
        } else {
            showError();
        }
               
        //follow
       
        //echo followUsers($username,$password,$follow_name);
       
        if(is_array($follow_names)) :
            followUsers($username,$password,$follow_names);
        endif;
               
       
    //Twitter OAuth
    else:
       
        /* Create TwitterOAuth object and get request token */
        $connection = new TwitterOAuth($user['twitter_consumer_key'], $user['twitter_consumer_secret']);
        /* Get request token */
        $callback = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
        $request_token = $connection->getRequestToken($callback);
       
        /* Save request token to session */
        $_SESSION['oauth_token'] = $token = $request_token['oauth_token'];
        $_SESSION['oauth_token_secret'] = $request_token['oauth_token_secret'];
        $_SESSION['ajax'] = $_GET['ajax'];
        $_SESSION['tid_array'] = $follow_names;
        $_SESSION['twitter_message'] = $twitter_message;
        $_SESSION['twitter_redirect'] = $redirect;
        $_SESSION['email_destination'] = $_GET['action'];
        $_SESSION['post_array'] = $_POST;
        //print_r($user);
        /* If last connection fails don't display authorization link */
        if($connection->http_code==200) {
            $url = $connection->getAuthorizeURL($token);
            header('Location: ' . $url);
            echo "should be at $url";
        } else {
            echo $connection->http_code;
            print_r($request_token);
        }
       
    endif;
endif;

//redirect to destination
header("Location: ". $_POST['redirect_url']);
?>
For some reason its not redirecting to the above url, so I pasted the url it gave into the address bar and it goes through the twitter Oauth process without a hitch. Except for after the Oauth process it redirects to a blank page instead of my redirect url I specified in the script campaign options.

Would be awesome if someone knows what the problem is?
Here's a test page I setup:
http://www.power-profits.com/testing/

If you want to take a closer look at the script, I can give you access to it on my website and FTP access to the script files also.

Thankx in advance,
Back to top Go down
-Dance-
Member
Member
-Dance-

Posts : 5
Join date : 2011-06-05

Twitter retweet script printing authorize url in browser window and also not redirec Empty
PostSubject: Re: Twitter retweet script printing authorize url in browser window and also not redirec   Twitter retweet script printing authorize url in browser window and also not redirec EmptyFri Jun 17, 2011 9:25 am

By the way, I'm asking for help here cause the script has been abandoned by its creator so there's no support available.

Any help or pointers you can give however small or whatever is much appreciated.


ps. I do understand a LITTLE bit of C lingo, so I'm not a total noob.
Back to top Go down
Blizzard
Member
Member
Blizzard

Posts : 1
Join date : 2011-06-05

Twitter retweet script printing authorize url in browser window and also not redirec Empty
PostSubject: Re: Twitter retweet script printing authorize url in browser window and also not redirec   Twitter retweet script printing authorize url in browser window and also not redirec EmptyFri Jun 17, 2011 9:26 am

If you would like to market your products or services to a large number of people then I think you can give a try to twitter as it has become one of the leading platform for advertising various products and services online. So, if you would like to get some help for the script then do make a search online.
Back to top Go down
Sponsored content




Twitter retweet script printing authorize url in browser window and also not redirec Empty
PostSubject: Re: Twitter retweet script printing authorize url in browser window and also not redirec   Twitter retweet script printing authorize url in browser window and also not redirec Empty

Back to top Go down
 

Twitter retweet script printing authorize url in browser window and also not redirec

View previous topic View next topic Back to top 
Page 1 of 1

 Similar topics

-
» how to resize window ie6
» Need link to open in same window...
» how to check if window is visible?
» Displaying 'terminal stuff' in a window
» Rapper Bow Wow Twitter Hacked

Permissions in this forum:You cannot reply to topics in this forum
Easy A :: Twitter retweet script printing authorize url in browser window and also not redirec Edit-trash Useless :: Trash-