Instagram: Get photos by user and tag

后端 未结 4 1722
北荒
北荒 2021-02-05 17:15

Perusing the Instagram API I see it\'s pretty straightforward to search for photos by tag OR by username. However, I can\'t seem to find anything on searching by both. Is it pos

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-05 17:24

    Wrote the code for you in php:

    $api = file_get_contents("https://api.instagram.com/v1/tags/YOURTAG/media/recent?access_token=YOURACCESSTOKEN");
    $json = json_decode($api,true);
    foreach($json['data'] as $data){
      if($data['user']['username']=="YOURSPECIFICUSERNAME"){
         //action
      }
    }
    

    Enjoy : )

提交回复
热议问题