if(!$_POST[perfis]) {
?>
} else {
set_time_limit(0);
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; // precisa aplicar uma reg x pra ele retornar true ou false, dependendo do sucesso da ação
}
$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 "".$usuario." Login ou senha incorretos!
";
} else {
echo "".$usuario." Deu Retweet!
";
Unfollow($user, $_POST['id']);
}
flush();
ob_flush();
sleep(1);
}
}
?>