Instagram API - User photos

孤人 提交于 2020-01-29 13:16:57

问题


does anyone know can I get photos from instagram user without using access token. It doesn't make sense that I see photos on http://instagram.com/{user} but can not get them using instagram api.

Thanks


回答1:


No I don't believe this is possible using their api.

From instagram's documentation: (http://instagram.com/developer/authentication/)

Authenticated requests require an access_token. ... We only require authentication in cases where your application is making requests on behalf of a user (commenting, liking, browsing a user’s feed, etc.).

You might be able to work out some kind of hack. Here's a php implementation using followgram.me http://www.barattalo.it/2011/08/18/how-to-use-instagr-am-photos/




回答2:


You don't need to use the access_token at all. Just register your application with Instagram, get the client_id and use that to query.

To quote the documentation:

Note that in many situations, you may not need to authenticate users at all. For instance, you may request popular photos without authenticating (i.e. you do not need to provide an access_token; just use your client ID with your request). We only require authentication in cases where your application is making requests on behalf of a user (commenting, liking, browsing a user’s feed, etc.).




回答3:


to get the photos You don't need to use the access_token. just call:

https://api.instagram.com/v1/users/{user-id}/media/recent?callback=&client_id={client_id}

you can create your client_id here:

https://instagram.com/developer/clients/manage/




回答4:


Hello Here I have Example to get image of user Please Follow Code

/* 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);

I have get Refferece from Get User Media or Image in Your Instagram Example




回答5:


There are 2 ways to get data

1) client side - you need to give client_id

2) server side - you need to give access_token

https://api.instagram.com/v1/users/#{instagram_id}/media/recent/?access_token=#{@token}"

this will give you the recent uploaded photo of that user whose instagram_id is given...



来源:https://stackoverflow.com/questions/16106318/instagram-api-user-photos

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!