Guys I'm working on the Instagrams API to get all images with a specific tag.
Here is my code:
<?PHP function callInstagram($url) { $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => 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 '<div style="display:block;float:left;">'.$Profile_name.' <br> <img src="'.$image_link.'" /></div>'; }
With this code, I get 20 images tagged with sweden .
I need to know how I can get min_tag_id and max_tag_id for this tag so that I can do something like pagination.
So can you give me any advice how can I get the id of the last message / image displayed?
Thanks in advance!
source share