Благотарю товарищ, теперь я понял как это использовать. Спасибо за помощь!
добрый вечер. Да это ответ серевера обработанный jsone_decode.
public 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; }
$token = 'token'; $user_id = 'self'; $result = $this->fetchData("https://api.instagram.com/v1/users/{$user_id}/media/recent/?access_token={$token}"); $result = json_decode($result); $i=1; $list_posts=array(); foreach ($result->data as $post){ $list_posts[$i]=$post; $i++; }
Дальше мне не совсем понятно как эти данные с массива достать и отобразить как пост с фото, я с этим никогда не работал(. в начале я показал массив элементов которые вернул jsone_decode. если попробовать не через dump() а print_r($list_posts); то результатом есть массив такого типа:
Array ( [1] => stdClass Object ( [id] => 2091308708226775433_5809569658 [user] => stdClass Object ( [id] => 5809569658 [full_name] => Boghdan Lee [profile_picture] => https://scontent.cdninstagram.com/vp/957b2300f04d939841d1f1e6275ae534/5DE5FB48/t51.2885-19/s150x150/20589608_142864822964837_173077896309506048_a.jpg?_nc_ht=scontent.cdninstagram.com [username] => boghdanlee ) [images] => stdClass Object ( [thumbnail] => stdClass Object ( [width] => 150 [height] => 150 " stdclass="" object="" (="" [width]=">" 640="" [height]=">" 640="" title=" => https://scontent.cdninstagram.com/vp/fdb3e02478750af947f293bd18b3314f/5DDEB6A5/t51.2885-15/e35/s150x150/67087966_846526665718303_3465859981705606230_n.jpg?_nc_ht=scontent.cdninstagram.com ) [low_resolution] => stdClass Object ( [width] => 320 [height] => 320 <a href=" rel="noreferrer noopener nofollow">" stdclass="" object="" (="" [width]=">" 320="" [height]=">" 320="" title=" => https://scontent.cdninstagram.com/vp/2549d7d11183c4d0522f759b1febdf66/5DDD2702/t51.2885-15/sh0.08/e35/s640x640/67087966_846526665718303_3465859981705606230_n.jpg?_nc_ht=scontent.cdninstagram.com ) ) [created_time] => 1563523447 [caption] => stdClass Object ( [id] => 17901051421345128 [text] => Something [created_time] => 1563523447 [from] => stdClass Object ( [id] => 5809569658 [full_name] => Boghdan Lee [profile_picture] => https://scontent.cdninstagram.com/vp/957b2300f04d939841d1f1e6275ae534/5DE5FB48/t51.2885-19/s150x150/20589608_142864822964837_173077896309506048_a.jpg?_nc_ht=scontent.cdninstagram.com [username] => boghdanlee ) ) [user_has_liked] => [likes] => stdClass Object ( [count] => 11 ) [tags] => Array ( ) [filter] => Normal [comments] => stdClass Object ( [count] => 0 ) [type] => carousel [link] => https://www.instagram.com/p/B0F0jCdibmJ/ [location] => [attribution] => [users_in_photo] => Array ( ) [carousel_media] => Array ( [0] => stdClass Object ( [images] => stdClass Object ( [thumbnail] => stdClass Object ( [width] => 150 [height] => 150 <a href=" rel="noreferrer noopener nofollow">" array="" (="" )="" [type]=">" image="" title=" => https://scontent.cdninstagram.com/vp/8a32b65495028c1e653b73060d8b8214/5DE22C55/t51.2885-15/e35/s320x320/67087966_846526665718303_3465859981705606230_n.jpg?_nc_ht=scontent.cdninstagram.com ) [standard_resolution] => stdClass Object ( [width] => 640 [height] => 640 <a href=" rel="noreferrer noopener nofollow">---------- Добавлено 31.07.2019 в 19:59 ----------
require "instagram_api_client" InstagramApi.config do |config| config.access_token = ENV['INST_TOKEN'] end images = (InstagramApi.user.recent_media ({count: 7})).data.map { |d| d.images.standard_resolution.url }
require "instagram_api_client"