Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2016
5,407
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <form method="post" action=''>
  2. <p><em>#Hashtag</em> <input type="text" name="tag" placeholder="Awesome"/><br>
  3. <input type="submit" value="Ok" /></p>
  4. </form>
  5.  
  6. <?php
  7. if(!empty($_POST['tag'])){
  8. $json_url = 'https://api.instagram.com/v1/tags/'.$_POST['tag'].'/media/recent?access_token=your_access_token';
  9. $json = file_get_contents($json_url);
  10. $links = json_decode($json);
  11.  
  12. foreach( $links->data as $datas ) {
  13.  
  14. if($datas->type=='video'){
  15. $url = $datas->videos->standard_resolution->url;
  16.  
  17. } else{
  18. $url = $datas->images->standard_resolution->url;
  19. }
  20. echo '<a href = "'.$url.'" target="blank"><img src ="'.$datas->images->thumbnail->url.'"/></a>'.'<br>';
  21. echo 'Tipe :'.$datas->type.'<br>';
  22. echo 'Like :'.$datas->likes->count.'<br>';
  23. echo 'Caption:'.$datas->caption->text.'<br>';
  24. echo 'Post ID :'.$datas->id.'<br>';
  25. echo 'Created On : '.date('Y-m-j H:i:s', $datas->created_time).'<br>';
  26. $tagarray=$datas->tags;
  27.  
  28. echo 'Tags: '.implode(", ", $tagarray).'<br>';
  29. foreach ($datas->users_in_photo as $usertag) {
  30. echo 'Users in Photo: '.$usertag->user->username.' | ';
  31. echo 'ID : '.$usertag->user->id.' | ';
  32. echo 'Fullname : '.$usertag->user->full_name.' | '.'<br><br>';
  33. }
  34. echo 'Created By :'.$datas->caption->from->username.' | ';
  35. echo 'ID :'.$datas->caption->from->id.' | ';
  36. echo 'Fullname :'.$datas->caption->from->full_name.' | ';
  37. echo '<a href = "'.$datas->caption->from->profile_picture.'" target="blank"><img style="width:30px; height:30px;" src ="'.$datas->caption->from->profile_picture.'"/></a>'.'<br><br>';
  38.  
  39.  
  40. }
  41. }
  42. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement