Jump to content
Fórum Script Brasil
  • 0

Twettar com varias contas


®manu®

Question

Olá pessoal;

Estou com uma grande dificuldade.

Crial um script para twettar a mesma mensagem para todos os twitters que tenho.

Form com os logins e senhas:

login:senha

login:senha

login:senha

Form com a mensagem.

Esta é a função para twettar 1 por 1.

SESSION_START();

$msg = $_POST['msg_twitter'];
$user = $_POST['usuario'];
$pass = $_POST['senha'];

$_SESSION['usuario']=$user;

$out="POST http://twitter.com/statuses/update.json HTTP/1.1rn"
  ."Host: twitter.comrn"
  ."Authorization: Basic ".base64_encode ("$user:$pass")."rn"
  ."Content-type: application/x-www-form-urlencodedrn"
  ."Content-length: ".strlen ("status=$msg")."rn"
  ."Connection: Closernrn"
  ."status=$msg";

$fp = fsockopen ('twitter.com', 80);
fwrite ($fp, $out);
fclose ($fp);

Como pegar meus dados e separar eles, executar a rotina e seguir para o próximo da lista?

Obrigado

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Ué, lol. É só repetir o código o.O

Fiz uma funçãozinha pra ficar mais limpo:

SESSION_START();

function enviaTwitter($user,$pass,$msg) {

    $out="POST http://twitter.com/statuses/update.json HTTP/1.1rn"
      ."Host: twitter.comrn"
      ."Authorization: Basic ".base64_encode ("$user:$pass")."rn"
      ."Content-type: application/x-www-form-urlencodedrn"
      ."Content-length: ".strlen ("status=$msg")."rn"
      ."Connection: Closernrn"
      ."status=$msg";

    $fp = fsockopen ('twitter.com', 80);
    fwrite ($fp, $out);
    fclose ($fp);
}

$msg = $_POST['msg_twitter'];

$user1 = $_POST['usuario1'];
$pass1 = $_POST['senha1'];
enviaTwitter($user1,$pass1,$msg);

$user2 = $_POST['usuario2'];
$pass2 = $_POST['senha2'];
enviaTwitter($user2,$pass2,$msg);

$user3 = $_POST['usuario3'];
$pass3 = $_POST['senha3'];
enviaTwitter($user3,$pass3,$msg);

$_SESSION['usuario'] = $user1;

Link to comment
Share on other sites

  • 0
Ué, lol. É só repetir o código o.O

Resultado final foi este, mas está uma bagunça e com um erro, acredito que esteja ficando bom;

<?php 
    set_time_limit(false);
    error_reporting(false);    
?>
<html>
<title>MassFollow</title>
<head>
    &lt;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">M</font><font face="Verdana">ensagem:</font><br />
<input name="msg" type="text" id="msg" value="" size="130" maxlength="125">
<br /><br />

<input type="submit" value="Enviar" id="btn">
</form>
<?php
if (isset($_POST["perfis"]))
    {
        $logins = explode("\n", $_POST["perfis"]);
        $msg = $_POST["msg"];
        $contar = count($logins);
        for($i = 0; $i <= $contar; $i++) 
            {
    //$logins[$i] = preg_replace("/^\d+\:/i", "", $logins[$i]);
if (!(preg_match("/[a-zA-Z0-9]+/i", $logins[$i])))
{
continue;
}
                $data = explode(":", $logins[$i]);
                if ($data[0][0] == "@")
                    $data[0] = str_replace("@", "", $data[0]);
                $ch = curl_init();
                curl_setopt_array($ch,
                     array(
                $out="POST [url="http://twitter.com/statuses/update.json"]http://twitter.com/statuses/update.
                json[/url] HTTP/1.1\r\n"
                  ."Host: twitter.com\r\n"
                  ."Authorization: Basic ".base64_encode ("$user:$pass")."\r\n"
                  ."Content-type: application/x-www-form-urlencoded\r\n"
                  ."Content-length: ".strlen ("status=$msg")."\r\n"
                  ."Connection: Close\r\n\r\n"
                  ."status=$msg";
                
                $fp = fsockopen ('twitter.com', 80);
                fwrite ($fp, $out);
                fclose ($fp); {
                    
}
                else {

$conteudo    =    "".$nomecerto.":".$senha."\r\n";
    $arquivo    =    "sadasfasdfasd.txt";
    if (!$abrir = fopen($arquivo, "a")) {
         echo  "Erro abrindo arquivo ($arquivo)";
         exit;
    }
    
    if (!fwrite($abrir, $conteudo)) {
        print "Erro ao cadastrar ($email1)";
        exit;
    }
    
    fclose($abrir);
                echo "".$data[0].":".$data[1]."<br>";
}
                flush();
                ob_flush();
            }
    }
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...