title: PHP Instagram API - How to get MIN_TAG_ID and MAX_TAG_ID
body: <p>Guys I'm working around the Instagrams API to get all images with a specific tag.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>&lt;?PHP
   function callInstagram($url)
      {
      $ch = curl_init();
      curl_setopt_array($ch, array(
      CURLOPT_URL =&gt; $url,
      CURLOPT_RETURNTRANSFER =&gt; true,
      CURLOPT_SSL_VERIFYPEER =&gt; false,
      CURLOPT_SSL_VERIFYHOST =&gt; 2
      ));
  
      $result = curl_exec($ch);
      curl_close($ch);
      return $result;
      }
  
      $tag = 'sweden';
      $client_id = "XXXX";
      $url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent?client_id='.$client_id;
  
      $inst_stream = callInstagram($url);
      $results = json_decode($inst_stream, true);
  
      //Now parse through the $results array to display your results... 
      foreach($results['data'] as $item){
          $image_link = $item['images']['thumbnail']['url'];
          $Profile_name = $item['user']['username'];
          echo '&lt;div style="display:block;float:left;"&gt;'.$Profile_name.' &lt;br&gt; &lt;img src="'.$image_link.'" /&gt;&lt;/div&gt;';
      }
  </code></pre>
  
  <p>With this code I get 20 of the images with tag <code>sweden</code>.</p>
  
  <p>I need to know how I can get the <code>min_tag_id</code> and <code>max_tag_id</code> for this tag so I can make a something like pagination.</p>
  
  <p>So can you give me any advice how can I get the ID of the last post/image displayed ?</p>
  
  <p>Thanks in advance!</p>