@
@
@atambalasi2016-04-25 08:08:30
PHP
@atambalasi, 2016-04-25 08:08:30

Instagram API combine data into one object?

I get two images by tag

$json = file_get_contents("https://api.instagram.com/v1/tags/ТУТмойТег/media/recent?access_token=tokenHere&count=1");
                    $json2 = file_get_contents("https://api.instagram.com/v1/tags/ТУТмойТег/media/recent?access_token=tokenHere&count=1");

Decoding
$data = json_decode($json);
  $data2 = json_decode($json2);

Pulling out the data
$images = array();
            $captions = array();
            $links = array();
            $photoNameWithHashtags = array();
            $photoName = array();
            $hashTags  = array();
                
    foreach($temp as $user_data ) {
                            $images[] = (array) $user_data->data->images;
                            $links[] =  $user_data->data->link;
                           $captions[] = $user_data->caption;
                            $hashTags[] = $user_data->tags;

     }

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

$temp array contain
$temp[0]=$data->data;
                $temp[1]=$data2->data;

The code is fully working if you place $temp in the loop to put $data->data.
How can I combine this data so that the above code works?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question