Advertisement
Guest User

astsatas

a guest
Oct 24th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <?php
  2. /*
  3. * @author xkatonsurya
  4. * 23 Jul 2014 06:39 AM
  5. * ganti header ini tak cipok ntar
  6. */
  7.  
  8. require_once('twitteroauth/twitteroauth.php');
  9.  
  10. function RandomLine($filename){
  11. $lines = file($filename);
  12. return $lines[array_rand($lines)];
  13. }
  14.  
  15. // settings tw app for web
  16. define('CONSUMER_KEY', 'ISI_CONSUMER_KEY_DISINI');
  17. define('CONSUMER_SECRET', 'ISI_CONSUMER_SECRET_DISINI');
  18. $oauth_token = "ISI_AKSES_TOKEN";
  19. $oauth_token_secret = "ISI_AKSES_SECRET";
  20.  
  21. echo "[+] Memulai ...\n\n";
  22. $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $oauth_token, $oauth_token_secret);
  23. $dapatkan = $connection->get('search/tweets', array('q'=>'#KatonSuryaA', 'result_type'=>'recent', 'count'=>'2')); // result_type bisa dilait di docs api twitter // pakein count biar lebih dari 15 atau kurang dari 15
  24. foreach ($dapatkan->statuses as $no => $value) {
  25. $id_str = $value->id_str;
  26. $text = $value->text;
  27. $screen_name = $value->user->screen_name;
  28. $random = RandomLine("spam.txt");
  29. $update = $connection->post('statuses/update', array('in_reply_to_status_id' => ''.$id_str.'', 'status'=>'@'.$screen_name.' '.$random.''));
  30. echo "".$id_str."|| ".$text." || ".$screen_name."\n";
  31. if(!empty($post->errors)){
  32. echo "Gagal Membalas...\n\n";
  33. }else{
  34. echo "Sukses Membalas...\n\n";
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement