Advertisement
virushsality

tweet.php

Jul 3rd, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. <?php
  2. /**
  3. * VirushLIB [Twitter]
  4. * @author Habib Bahruddin
  5. * @copyright VirushLIB
  6. **/
  7.  
  8. ini_set('display_errors', 1);
  9. require_once('OAuth.php');
  10. $virushlogic = "VirushLIB#1"; // Abaikan Saja Yang Perlu Di Edit $username
  11. $username = "nabilahJKT48"; // Target Username
  12. $data = str_replace("VirushLIB", $username, $virushlogic);
  13. $x_data = explode("#", $data);
  14.  
  15. // Buat APP Dulu Di https://dev.twitter.com/apps/
  16. $oauth = array(
  17.     'oauth_access_token' => "Isi Dengan TOKEN Kamu",
  18.     'oauth_access_token_secret' => "Isi Dengan TOKEN_SECRET Kamu",
  19.     'consumer_key' => "Isi Dengan Consumer Key Kamu",
  20.     'consumer_secret' => "Isi Dengan Consumer Secret Kamu"
  21. );
  22.  
  23. $url = "https://api.twitter.com/1.1/statuses/user_timeline.json";
  24. $method = "GET";
  25. if (isset($_GET['user'])) {
  26.     $user = $_GET['user'];
  27. }
  28. else {
  29.     $user = $x_data[0];
  30. }
  31.  
  32. if (isset($_GET['count'])) {
  33.     $count = $_GET['count'];
  34. }
  35. else {
  36.     $count = $x_data[1];
  37. }
  38.  
  39.  
  40. $get = "?screen_name=$user&count=$count";
  41. $new = new TwitterAPIExchange($oauth);
  42. $hasil = json_decode($new->setGetfield($get)
  43. ->buildOauth($url, $method)
  44. ->performRequest(),$assoc = TRUE);
  45.  
  46. foreach($hasil as $tampil) {
  47.     $tweet = $tampil['text'];
  48.     $x_url = 'https://api.twitter.com/1.1/statuses/update.json';
  49.     $x_method = 'POST';
  50.     $eksekusi = array(
  51.         'status' => $tweet,
  52.     );
  53.  
  54.     $x_new = new TwitterAPIExchange($oauth);
  55.     $x_new->buildOauth($x_url, $x_method)
  56.              ->setPostfields($eksekusi)
  57.              ->performRequest();
  58. }
  59. echo "$tweet [<b><font color='lime'>DONE</font></b>]<br>";
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement