Guys I'm working on a PHP script which is getting all images for a specific tag in Instagram.
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 = "1e0f576fbdb44e299924a93cace24507";
$Next_URL = $_GET["nexturl"];
if($Next_URL == ""){
$url = 'http://ift.tt/SUv5zZ'.$tag.'/media/recent?client_id='.$client_id.'&count=24';
} else {
$url = $Next_URL;
}
$inst_stream = callInstagram($url);
$results = json_decode($inst_stream, true);
$maxid = $results['pagination']['next_max_id'];
$nexturl = $results['pagination']['next_url'];
//Now parse through the $results array to display your results...
?>
<div class="holder" style="display:block;margin-left:70px;">
<?PHP
foreach($results['data'] as $item){
$image_link = $item['images']['thumbnail']['url'];
$big_image = $item['images']['standard_resolution']['url'];
echo "Image: $image_link";
}
This script is getting information about only one tag - sweden.
How can I make this code get all the information about more then one tag, for example let's say for another two tags - england and germany ?
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire