Advertisement
GWibisono

silakan di kondisikan

Jan 30th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $token = file_get_contents("token.txt");
  3.  
  4.  
  5.  
  6. $ips = '104.219.248.23';
  7. $secret = 'a0322a2844bb46aca29983b8599e33e8';
  8.  
  9. $signature = (hash_hmac('sha256', $ips, $secret, false));
  10. $header = join('|', array($ips, $signature));
  11.  
  12.  
  13.  
  14. function curl($url, $post = null) {
  15.     $ch = curl_init();
  16.     curl_setopt($ch, CURLOPT_URL, $url);
  17.     if ($post != null) {
  18.         curl_setopt($ch, CURLOPT_POST, true);
  19.         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
  20.     }
  21.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  22.  
  23.     curl_setopt($ch, CURLOPT_HTTPHEADER, array('X-Insta-Forwarded-For:'.$header));
  24.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  25.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  26.     $exec = curl_exec($ch);
  27.     curl_close($ch);
  28.     return $exec;
  29. }
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36. $curl   = curl("https://api.instagram.com/v1/users/self/feed?count=3&access_token=" . $token);
  37. $ngirim = json_decode($curl );
  38. if(!is_object($ngirim)){
  39.     die('unknown result:'.htmlentities($curl ) );
  40. }
  41.  
  42. if(!isset($ngirim->data)){
  43.     die('data not valid: <pre>'.print_r($ngirim,1)."</pre>" );
  44. }
  45.  
  46. foreach ($ngirim->data as $data) {
  47.     $lampu = $data->username;
  48.     $cahaya  = curl("https://api.instagram.com/v1/media/" . $data->id . "/likes", array(
  49.         "access_token" => $token
  50.     ));
  51.     $ngirim2 = json_decode($cahaya);
  52.  
  53.     if(!is_object($ngirim2)){
  54.         die('curl media not valid: <pre>'.print_r($cahaya)."</pre>" );
  55.     }
  56.    
  57.     if ($ngirim->meta->code == "200"){
  58.         echo "[WORK]";
  59.     }
  60.     else{
  61.         echo "[FAIL] ".$ngirim->meta->code;
  62.     }
  63.  
  64.     sleep(2);
  65.  
  66.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement