Mass Retweet php script needs a fix

webwhizz

BANNED
Joined
Apr 3, 2011
Messages
725
Reaction score
659
Hi, i just found this twitter mass retweet script ive tested it but it keeps saying Wrong Password on all the accounts i use, does anyone have a fix for this? thanks

Code:
<?php

function login($email, $password) {
    $ch = curl_init();
    curl_setopt_array($ch, array(
            CURLOPT_URL => 'https://mobile.twitter.com/session/new',
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_HEADER => true
        )
    );
    
    $response = curl_exec($ch);
    preg_match("/_mobile_sess=[^\s]+/", $response, $_mobile_sess);
    preg_match("/name=\"authenticity_token\" type=\"hidden\" value=\"([^\"]+)/", $response, $authenticity_token);
    curl_setopt_array($ch, array(
            CURLOPT_URL => 'https://mobile.twitter.com/session',
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POST => true,
            CURLOPT_COOKIE => $_mobile_sess[0],
            CURLOPT_SSL_VERIFYPEER => false,
            CURLOPT_POSTFIELDS => 'authenticity_token=' . $authenticity_token . '&username=' . trim(rawurlencode($email)) . '&password=' . trim(rawurlencode($password)),
            CURLOPT_HEADER => true
        )
    );
    
    $response = curl_exec($ch);
    preg_match("/k=[^\s]+/", $response, $k);
    preg_match("/_mobile_sess=[^\s]+/", $response, $mobile);
    preg_match("/oauth_token=[^\s]+/", $response, $oauth);
    
    curl_close($ch);
    return $k[0] . $mobile[0] . $oauth[0]; // retorna os cookies
}


function unfollow($cookies, $id) {
    $ch = curl_init();
    curl_setopt_array($ch, array(
            CURLOPT_URL => 'http://mobile.twitter.com/',
            CURLOPT_COOKIE => $cookies,
            CURLOPT_RETURNTRANSFER => true
        )
    );
    
    $response = curl_exec($ch);
    preg_match("/name=\"authenticity_token\" type=\"hidden\" value=\"([^\"]+)/", $response, $authenticity);
    curl_setopt_array($ch, array(
            CURLOPT_URL => "http://mobile.twitter.com/statuses/".$id."/retweet",
            CURLOPT_RETURNTRANSFER => true,
            CURLOPT_POST => true,
            CURLOPT_REFERER => 'mobile.twitter.com/',
            CURLOPT_COOKIE => $cookies,
            CURLOPT_FOLLOWLOCATION => false,
            CURLOPT_POSTFIELDS => 'authenticity_token=' .$authenticity[1]. '&authenticity_token=' . $authenticity[1]. '&x=1&y=8'
        )
    );
    
    $response = curl_exec($ch);
    return $response;
}


if (!isset($_POST['perfis'])) {
?>


<html>
<title>MassRetweet</title>
<head>
 <style type="text/css">
  #btn
   {
    background: transparent;
    border: solid thin;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    font-family: Verdana;
    width: 300px;
   }
  #follow
   {
    background: transparent;
    border: solid thin;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    font-family: Verdana;
   }
  textarea
   {
    width: 400px;
    height: 320px;
   }
  .work
   {
    font-weight: bold;
    color: green;
   }
  .notwork
   {
    font-weight: bold;
    color: red;
   }
  a
   {
    color: #000000;
    font-weight: bold;
   }
 </style>
 <script type="text/javascript">
  function countFakes()
   {
    document.getElementById("count").innerHTML = document.getElementById("perfis").value.split("\n").length;
   }
 </script>
</head>
<center>
<form method="POST" action="">
<textarea name="perfis" id="perfis" onkeydown="countFakes()" onchange="countFakes()"></textarea><br />
<font id="count" style="font-weight: bold;">0</font> Perfis inseridos.<br /><br />
<font face="Verdana">ID of Tweet</font><br />
<input type="text" name="id" id="id" /><br /><br />
<input type="submit" value="Re-Tweet" id="btn">
</form>
</center>
</html>


<?php
} else {
    set_time_limit(0);


    $login = $_POST['perfis'];
    $logins = explode("\n", $login);
    foreach ($logins as $perfil) {
        $data = explode(":", $perfil);
        $usuario = trim($data[0]);
        $senha = trim($data[1]);
        $user = login($usuario, $senha);
        
        if (!preg_match("/auth/", $user)) { 
            echo "<center><font color=\"red\">".$usuario." Login ou senha incorretos!</font><br>";
        } else {
            echo "<center><b><font color=\"green\">".$usuario." </font>Deu Retweet!</b><br>";
            unfollow($user, $_POST['id']);
        }


        sleep(1);
    }
}
?>
 
It is old script, since then twitter changed a lot of things... Now you need to create app, API consumer key and secret, enable permissions etc to make it to work.
 
nah it uses streaming api i believe, the same way the massfollow script and tweetadder works no oauth

It is old script, since then twitter changed a lot of things... Now you need to create app, API consumer key and secret, enable permissions etc to make it to work.
 
Back
Top