WordPress.org

Forums

Instagram wp_remote_get Not Working (2 posts)

  1. halluzineyt
    Member
    Posted 1 year ago #

    <?php
    
      $result = wp_remote_get("https://api.instagram.com/v1/users/***/media/recent/?access_token=1*************&count=60", true);
    	$decode = json_decode($result['body'], true);
    
      foreach ($decode->data as $post) {
         if(empty($post->caption->text)) {
           // Do Nothing
         }
         else {
            echo '<a class="instagram-unit" target="blank" href="'.$post->link.'">
            <img src="'.$post->images->low_resolution->url.'" alt="'.$post->caption->text.'" width="50" height="auto" />
            </a>';
         }
    
      }
    ?>

    Im trying to pull instagram images using this code so i can use it to perform another jquery script but i cant get this work can you check?

  2. Andrew
    Forum moderator
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic