function fetchData($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$result = fetchData("https://api.instagram.com/v1/users/ID-GOES-HERE/media/recent/?access_token=TOKEN-GOES-HERE");
$result = json_decode($result);
foreach ($result->data as $post) {
// Do something with this data.
}
?>
veya
function fetch_data($url){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$count = 10; // the number of photos you want to fetch
$access_token = "YOUR_ACCESS_TOKEN";
$display_size = "thumbnail"; // you can choose between "low_resolution", "thumbnail" and "standard_resolution"
$result = fetch_data("https://api.instagram.com/v1/users/self/feed?count={$count}&access_token={$access_token}");
$result = json_decode($result);
echo "";
?>
Api almak istemiyorsan:
//yes you can. you don't need to login or access_token to get the latest 20 posts. you just need to parse the json content from https://www.instagram.com/ [USERNAME]/media/ Replace the [username] with the instagram user_name
//eg.
$instaResult= file_get_contents('https://www.instagram.com/'.$username.'/media/')
$insta = json_decode($instaResult);
https://github.com/pinceladasdaweb/instaphotos