Skip to content

Instantly share code, notes, and snippets.

@asilbalaban
Last active August 29, 2015 14:16
Show Gist options
  • Select an option

  • Save asilbalaban/0cca68e595f38fc851e8 to your computer and use it in GitHub Desktop.

Select an option

Save asilbalaban/0cca68e595f38fc851e8 to your computer and use it in GitHub Desktop.
with this script you can get latest instagram pictures of any user without auth
<?php
function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$result = fetchData("https://api.instagram.com/v1/users/28596008/media/recent/?client_id=[YOUR CLIENT ID]&count=6");
$result = json_decode($result);
foreach ($result->data as $post) {
echo '<a href="{{$post->link}}"><img src="{{$post->images->low_resolution->url}}" alt="" /><span class="hover"></span></a>';
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment