Sunday 25 December 2016

Get User Media or Image in Your Instagram Example

Hello,


<?php

/* Get image in your instagram Account */

$set_scope_your_app ="https://www.instagram.com/oauth/authorize/?

client_id=Added-your-client_id&

redirect_uri=Added-your-redirect_uri&response_typ

e=code&scope=public_content";


$get_acess_token = "https://instagram.com/oauth/authorize/?

client_id=Added-your-client_id&

redirect_uri=Added-your-redirect_uri&respons

e_type=token";

$url="https://api.instagram.com/v1/users/self/media/recent/?access_token=Added-your-access_token";
 $json = file_get_contents($url);
$data = json_decode($json);


$images = array();
foreach( $data->data as $user_data ) {
    $images[] = (array) $user_data->images;
}

$standard = array_map( function( $item ) {
    return $item['standard_resolution']->url;
}, $images );

echo "<pre>";
print_r($standard);


echo "<pre>";
print_r($standard);

5 comments:

  1. How can I get all the images from perticular account? Right now above code displays 20 images.

    ReplyDelete
    Replies
    1. You need to submit your application for approval.

      Delete
  2. For that you need to submit your application. Once yours is approved by Instagram then you will get all the photos.

    Do you got photos of other ig users without their authentication.?

    ReplyDelete

Thank You For Comment