I read the instargam API and searched the code in google but not getting any exact solution for my requirement. I want to show my recent photos in my website like Facebook plugin. My images look like -
I tried following URL but I am getting error. Can you check -
https://api.instagram.com/v1/tags/nofilter/media/recent?access_token=fb2e77d.47a0479900504cb3ab4a1f626d174d2d
And
https://api.instagram.com/v1/users/user-id/media/recent/?access_token=72020554b1884a9691352d4cd9759951
Please suggest me how to show my recent photos looks like above screenshot?
Edit : I have Client ID
and Client Secreat
. Let me know which one is Access Token
?
I have used this API
Please check. I am sure this will helps to you.
<?php
$access_token = 'YOUR_3rd_PARTY_ACCESS_TOKEN';
$user_id = 'INSTAGRAM_USER_ID';
$json_profile = file_get_contents("https://api.instagram.com/v1/users/{$user_id}/?access_token={$access_token}");
$json = file_get_contents("https://api.instagram.com/v1/users/{$user_id}/media/recent/?access_token=" . $access_token . "&count=9");
$a_json_profile = json_decode($json_profile, true);
$a_json = json_decode($json, true);
//echo "<pre>";
//print_r($json2);
//echo "</pre>"; exit;
$i = 0;
foreach ($a_json['data'] as $key => $value) {
//if ($i < 9) {
$a_images[$i]['link'] = $value['link'];
$a_images[$i]['url'] = $value['images']['thumbnail']['url'];
//$a_images[$value['id']]['caption'] = $value['caption']['text'];
$i++;
//}
}
shuffle($a_images);
$finalData = array('info'=>$a_json_profile, 'images'=>$a_images);
echo json_encode($finalData);
exit;