Share Pastebin
Guest
Public paste!

g0rillapen1s

By: a guest | Jul 4th, 2009 | Syntax: PHP | Size: 3.01 KB | Hits: 10 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. <?php
  2.  
  3. /*
  4.  INSTRUCTIONS:
  5.  1.  Register 3 (three) accounts on Twitter - no email validation, so it's easy. You can't just use one account because it will get blocked quickly.
  6.  2. Save this script (the WHOLE file) as "twitter.php" in C:\Documents and Settings\Your_Username
  7.  3. Edit the file with notepad, fill in the usernames and passwords of the three accounts you've registered - see below, it's really simple
  8.  4. Install PHP 5.3 from http://php.net (direct Windows download - http://windows.php.net/download)
  9.  5. Open command line (Start -> Run -> cmd.exe)
  10.  6. Type in php -f twitter.php and leave it running
  11.  7. ????
  12.  8. PROFIT
  13. */
  14.  
  15. $accounts = array( // fill in usernames/passwords here as shown below
  16. array('username1', 'password1'),
  17. array('username2', 'password2'),
  18. array('username3', 'password3')
  19. );
  20. // have fun
  21.  
  22. // if you know what you're doing you can of course add more username/password combinations
  23. // then you can also decrease the timer value:
  24.  
  25. $timer = 15;
  26.  
  27. $useragent="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
  28. $hashtag = "#gorillapenis";
  29.  
  30. $topics = array(
  31. "ebaums", "nigger", "aids", "cancer", "gorilla", "faggot", "n00b", "penis", "vagina", "asshole",
  32. "butthurt", "ebaumsworld", "koran", "islam", "basement", "retard", "merkel", "listening to", "movie",
  33. "happy hour", "love", "hate", "virgin", "lulz", "nazi", "hitler", "negro", "anime", "manga",
  34. "pooper", "sex", "anal"
  35. );
  36.  
  37.  
  38. $tweetUrl = 'http://www.twitter.com/statuses/update.xml';
  39. $searchUrl = 'http://search.twitter.com/search.json?q=';
  40.  
  41. $cnt = 0;
  42. $ucnt = 0;
  43. $tweets = array();
  44.  
  45. random_tweets();
  46.  
  47. while(1) {
  48.   $status = $hashtag . ' ' . $tweets[rand(0,count($tweets)-1)]; ;
  49.   if (strlen($status) > 140) $status = substr($status,0,140);
  50.   $status = urlencode(stripslashes(urldecode($status)));
  51.   $username = $accounts[$ucnt][0];
  52.   $password = $accounts[$ucnt][1];
  53.   $ucnt++;
  54.   if ($ucnt == count($accounts)) {
  55.    $ucnt = 0;
  56.    $tweets = array();
  57.    random_tweets();
  58.   }
  59.   $curl = curl_init();
  60.   curl_setopt($curl, CURLOPT_URL, "$tweetUrl");
  61.   curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 2);
  62.   curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  63.   curl_setopt($curl, CURLOPT_POST, 1);
  64.   curl_setopt($curl, CURLOPT_POSTFIELDS, "status=$status");
  65.   curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
  66.   curl_setopt($curl, CURLOPT_USERAGENT, $useragent);
  67.   $result = curl_exec($curl);
  68.   $resultArray = curl_getinfo($curl);
  69.   if ($resultArray['http_code'] == 200) {
  70.     $cnt++;
  71.     echo "Tweet posted from account $username. ";
  72.     echo "Altogether, $cnt tweets posted.\n";
  73.   } else {
  74.     echo "$result";
  75.     echo "Could not post tweet to Twitter right now. Try again later.\n";
  76.   }
  77.   curl_close($curl);
  78.   sleep($timer);
  79. }
  80.  
  81. function random_tweets()
  82. {
  83.  global $topics,$searchUrl,$tweets;
  84.  $topic = urlencode($topics[rand(0,count($topics)-1)]);
  85.  $content = file_get_contents("$searchUrl$topic");
  86.  $content = json_decode($content, true);
  87.  foreach ($content["results"] as $a => $b) {
  88.    $tweets[] = $b["text"];
  89.  }
  90. }
  91. ?>