Advertisement
Guest User

Instagram New API Fix

a guest
Mar 17th, 2018
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.99 KB | None | 0 0
  1. <?php
  2. $username = 'ramadhani.pratama';
  3.  
  4. $apinya = curl('https://www.instagram.com/'.$username.'/?__a=1');
  5. $hpr = json_decode($apinya,1);
  6.  
  7. if($hpr['graphql']['user']['is_private'] == "1"){
  8.   $priv = 'Yes';
  9. }else{
  10.   $priv = 'No';
  11. }
  12.  
  13. $id = $hpr['graphql']['user']['id'];
  14. $username = $hpr['graphql']['user']['username'];
  15. $name = $hpr['graphql']['user']['full_name'];
  16. $biography = $hpr['graphql']['user']['biography'];
  17. $folwed = $hpr['graphql']['user']['edge_followed_by']['count'];
  18. $folwing = $hpr['graphql']['user']['edge_follow']['count'];
  19. $media = $hpr['graphql']['user']['edge_owner_to_timeline_media']['count'];
  20. $last_update = $hpr['graphql']['user']['edge_owner_to_timeline_media']['edges'][0]['node']['id'].'_'.$hpr['graphql']['user']['edge_owner_to_timeline_media']['edges'][0]['node']['owner']['id'];
  21. $pic = $hpr['graphql']['user']['profile_pic_url_hd'];
  22. $pic  = explode("vp", $pic);
  23. $post_id = $hpr['graphql']['user']['edge_owner_to_timeline_media']['edges'][0]['node']['shortcode'];
  24.  
  25. print ' <img class="img-circle" src="https://scontent-sit4-1.cdninstagram.com/vp'.$pic[1].'" alt="'.$hpr['graphql']['user']['full_name'].'"><br>';
  26. print 'ID : '.$id.'<br>';
  27. print 'Username : '.$username.'<br>';
  28. print 'Private : '.$priv.'<br>';
  29. print 'Name : '.$name.'<br>';
  30. print 'Biography : '.$biography.'<br>';
  31. print 'Followers : '.$folwed.'<br>';
  32. print 'Following : '.$folwing.'<br>';
  33. print 'Media : '.$media.'<br>';
  34. print 'Last Update : '.$last_update.'<br>';
  35. print 'Url Post : https://www.instagram.com/p/'.$post_id.'<br>';
  36.  
  37. //print '<pre>'.print_r($hpr,1).'</pre>';
  38.  
  39.  
  40.  
  41. function curl($url, $data=null) {
  42.   $c = curl_init();
  43.   curl_setopt($c, CURLOPT_URL, $url);
  44.   if($data != null){
  45.       curl_setopt($c, CURLOPT_POST, true);
  46.       curl_setopt($c, CURLOPT_POSTFIELDS, $data);
  47.   }
  48.   curl_setopt($c, CURLOPT_FOLLOWLOCATION, true);
  49.   curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
  50.   curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
  51.   $result = curl_exec($c);
  52.   curl_close($c);
  53.   return $result;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement