Steps : How to display Instagram uploaded images on website :
An Instagram account is required for login.
If you have an account then login to your Instagram account with your Email Id or Mobile Number and Password,
Alternatively you can login using facebook account too.
Otherwise, You have to create an account on Instagram and log in with that account on an Instagram website.
If you are the new user, then you have to Upload Images to your Instagram account.
Generate Access Token Key with the following link for your Instagram account.
http://instagram.pixelunion.net/
You have to click on the button that is displayed on the website for generating Access Token Key. – Generate Access Token.
You are not logged in currently, then log in with your Instagram email id and password.
After generating Access Token Key, integrate this Access Token key with API for fetching images from your Instagram Account.
Format of the Generated Token:
544758xxxx.xxxxed0.fb27d9db186f47168eed3b9534de5f78
API for fetching Images via Access Token Key. We are using Curl Session for integrating API.
$accessToken = "544758xxxx.xxxxed0.fb27d9db186f47168eed3b9534de5f78";
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/self/media/recent/? access_token=".$accessToken);
$result = json_decode($result);
Access $result array value on the view page where you want to display all the Instagram images on the website.
By:-
Harshita Maheshwari - Jr. Software Engineer
Comments
pavni jaiswal
Mauricio
write to us
contact@ucodice.com