How do you get the pictures out of the instagram without extra copying?



  • I'm trying to get a picture out of the intragram on some heshtag. There's a page where users need to show the final photos of this current.

    In doing so, the user needs to just come in and see the photo, not copy in the annex to see the content. ♪ ♪

    I understand the Instagram has changed the API and working conditions, so the Internet doesn't work... Help understand the logic and algorithm of work in this case.


    It's perfect for a working example. I've tried it, but it doesn't work.

    function callInstagram($url)
    {
    $ch = curl_init();
    curl_setopt_array($ch, array(
    CURLOPT_URL => $url,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_SSL_VERIFYHOST => 2
    ));
    

    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
    }

    $tag = 'YOUR_TAG_HERE';
    $client_id = "YOUR_CLIENT_ID";
    $url = 'https://api.instagram.com/v1/tags/'.$tag.'/media/recent?client_id='.$client_id;

    $inst_stream = callInstagram($url);
    $results = json_decode($inst_stream, true);

    //Now parse through the $results array to display your results...
    foreach($results['data'] as $item){
    $image_link = $item['images']['low_resolution']['url'];
    echo '<img src="'.$image_link.'" />';
    }

    How do we do the right thing?



  • There was a question.

    These are all new instagrams. The fact is that, since 17 November 2015, all new applications have been in the sand mode.

    Which means you can only get a picture of the sandbox user on the hose. In this case, the owner of the token was me, and I didn't have a photo Hashtag.

    That's why there was an empty answer. I added a photo of the right Hashtag, and everything worked out as needed.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2