Show user Instagram photos on the site

I am trying to display my latest photos on my website. I used this in a previous version of the Instagram API, but now that it has changed, I can’t.

I created the application on my Instagram account and performed all the authentication described in the documents, but it always shows me a screen asking for the user's login. But I need to show photos, even if the user is not registered, is this possible in this new version of the API?

PS. I am using PHP on the server side.

Thanks.

+4
source share
2 answers

instagram . api. api URL- . URL-.

+1
<?php
  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.
  }
?>

+1

Source: https://habr.com/ru/post/1618880/


All Articles