Advertisement
Br0th3r

like.php

Aug 29th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.45 KB | None | 0 0
  1. <?php
  2. /*
  3. filename : like.php
  4. */
  5.  
  6. @ini_set("output_buffering", "Off");
  7. @ini_set('implicit_flush', 1);
  8. @ini_set('zlib.output_compression', 0);
  9. @ini_set('max_execution_time',1200);
  10. header( 'Content-type: text/html; charset=utf-8' );
  11.  
  12. include('config.php');
  13.  
  14. function SendRequest($url, $post, $post_data, $user_agent, $cookies) {
  15. $ch = curl_init();
  16. curl_setopt($ch, CURLOPT_URL, 'https://instagram.com/api/v1/'.$url);
  17. curl_setopt($ch, CURLOPT_USERAGENT, $user_agent);
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  19. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  20. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept-Language: id'));
  21.  
  22. if($post) {
  23. curl_setopt($ch, CURLOPT_POST, true);
  24. curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
  25. }
  26.  
  27. if($cookies) {
  28. curl_setopt($ch, CURLOPT_COOKIEFILE, 'cookies.txt');
  29. } else {
  30. curl_setopt($ch, CURLOPT_COOKIEJAR, 'cookies.txt');
  31. }
  32.  
  33. $response = curl_exec($ch);
  34. $http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  35. curl_close($ch);
  36.  
  37. return array($http, $response);
  38. }
  39.  
  40. function GenerateGuid() {
  41. return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
  42. mt_rand(0, 65535),
  43. mt_rand(0, 65535),
  44. mt_rand(0, 65535),
  45. mt_rand(16384, 20479),
  46. mt_rand(32768, 49151),
  47. mt_rand(0, 65535),
  48. mt_rand(0, 65535),
  49. mt_rand(0, 65535));
  50. }
  51. function GenerateUserAgent() {
  52. $resolutions = array('720x1280', '320x480', '480x800', '1024x768', '1280x720', '768x1024', '480x320');
  53. $versions = array('GT-N7000', 'SM-N9000', 'GT-I9220', 'GT-I9100');
  54. $dpis = array('120', '160', '320', '240');
  55.  
  56. $ver = $versions[array_rand($versions)];
  57. $dpi = $dpis[array_rand($dpis)];
  58. $res = $resolutions[array_rand($resolutions)];
  59.  
  60. return 'Instagram 4.'.mt_rand(1,2).'.'.mt_rand(0,2).' Android ('.mt_rand(10,11).'/'.mt_rand(1,3).'.'.mt_rand(3,5).'.'.mt_rand(0,5).'; '.$dpi.'; '.$res.'; samsung; '.$ver.'; '.$ver.'; smdkc210; en_US)';
  61. }
  62.  
  63. function GenerateSignature($data) {
  64. return hash_hmac('sha256', $data, 'b4a23f5e39b5929e0666ac5de94c89d1618a2916');
  65. }
  66.  
  67.  
  68. $agent = GenerateUserAgent();
  69. $guid = GenerateGuid();
  70. $device_id = "android-".$guid;
  71.  
  72. echo "-- Grab Foto Timeline Instagram --<br/>";
  73. $feed = SendRequest('feed/timeline/?max_id=', false, false, $agent, true);
  74. $obj = json_decode($feed[1]);
  75. foreach ($obj->items as $items) {
  76. $mau_ngelike = $items->mau_ngelike;
  77. if($mau_ngelike == False) {
  78.  
  79. $ID = $items->id;
  80. $user = " @". $items->user->username;
  81.  
  82. $data = '{"media_id":"'.$ID.'"}';
  83. $sig = GenerateSignature($data);
  84. $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=4';
  85. $like = SendRequest('media/'.$ID.'/'.$action.'/', true, $new_data, $agent, true);
  86.  
  87. echo "[+] <font color=green>Sukses Like @" . $items->user->username . "</font><br/>";
  88. } else {
  89. echo "Fotonya @" . $items->user->username . " sudah di like.<br/>";
  90. }
  91. if($komen == true){
  92. $comment_text = $comment_text;
  93. $data = '{"comment_text":"'.$comment_text.'"}';
  94. $sig = GenerateSignature($data);
  95. $new_data = 'signed_body='.$sig.'.'.urlencode($data).'&ig_sig_key_version=4';
  96. $post_comment = SendRequest('media/'.$ID.'/comment/', true, $new_data, $agent, true);
  97. $obj3 = json_decode($post_comment[1]);
  98. //print_r($post_comment);
  99. if ($obj3->status == "ok") {
  100. echo "[+] <font color=green>Sukses Komen</font><br/>";
  101. sleep(2); //Takut kena blokir komen :v
  102. } else {
  103. echo "[-] <font color=red>Gagal komen</font><br/>";
  104. }
  105. }
  106. flush();
  107. ob_flush();
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement