title: Get photos and likes with php via Instagram API
body: <p>While using an Instagram <code>client_id</code> API request like here:</p>
  
  <blockquote>
    <p><a href="https://api.instagram.com/v1/users/" rel="nofollow">https://api.instagram.com/v1/users/</a>{user-id}/media/recent/?client_id=YOUR-CLIENT_ID</p>
  </blockquote>
  
  <p>I can actually SEE both the image url and like-count in the JSON response, but can't figure out how to extract both. I can only seem to extract the image itself like so:</p>
  
  <pre><code>&lt;?php
  if (!empty($_GET['user_id'])){
      $user_id = ($_GET['user_id']);
  
      // connect to the instagram API
    $instagram_url = 'https://api.instagram.com/v1/users/' . $user_id . '/media/recent/?client_id=MY-CLIENT-ID';
    $instagram_json = file_get_contents($instagram_url);
    $instagram_array = json_decode($instagram_json, true);
  }
  ?&gt;
  </code></pre>
  
  <p>--</p>
  
  <pre><code>&lt;?php
    if(!empty($instagram_array)){
      foreach($instagram_array['data'] as $key=&gt;$image){
        echo '&lt;img src="'.$image['images']['standard_resolution']['url'].'" alt=""/&gt;&lt;br&gt;';
      }
    }
  ?&gt;
  </code></pre>
  
  <p>ps - this is all cobbled together from various tutorials etc. I am total noob, so a little hand-holding would be appreciated:)</p>