Php Instagram API:从具有特定标签的特定用户处获取帖子

Php Instagram API:从具有特定标签的特定用户处获取帖子,php,api,instagram,Php,Api,Instagram,我知道这两个端点:/users/{user id}/media/recent和/tags/{tag name}/media/recent 但我试图只获取某个用户的帖子,该用户也有某个标签。有没有一个简单的方法可以做到这一点 目前我正在使用这个库,做如下工作: require 'vendor/Instagram-PHP-API/instagram.class.php'; $api = new Instagram('API KEY'); // Get Hashtag Search $result

我知道这两个端点:
/users/{user id}/media/recent
/tags/{tag name}/media/recent

但我试图只获取某个用户的帖子,该用户也有某个标签。有没有一个简单的方法可以做到这一点

目前我正在使用这个库,做如下工作:

require 'vendor/Instagram-PHP-API/instagram.class.php';
$api = new Instagram('API KEY');

// Get Hashtag Search
$result = $api->getTagMedia('somehashtag', 4); // This brings me back the last 4 posts by any user :/   

// Store in a local file for JS consumption
$json = json_encode($result);
$file = TEMPLATEPATH . '/js/instagrams.json';
$fh = fopen($file, 'w');
fwrite($fh, $json);
fclose($fh);

有人知道一种简单的方法吗?

这就是我最后做的,只是把它放在某个地方,以防其他人也尝试做同样的事情

require 'vendor/Instagram-PHP-API/instagram.class.php';
$api = new Instagram('API KEY'); // Client ID

// Get Recent Search
$result = $api->getUserMedia('THE USER ID', 20);
$data = $result->data;

$newresult = new stdClass();
$newdata = array();


foreach($data as $index=>$instagram) {
    if (in_array('somehashtag', $instagram->tags)) {
        array_push($newdata, $instagram);
    }
}

$newresult->data = $newdata;

$json = json_encode($newresult);
$file = TEMPLATEPATH . '/js/instagrams.json';
$fh = fopen($file, 'w');
fwrite($fh, $json);
fclose($fh);
因此,
$newresult
是我的新对象,它只包含来自具有指定hashtag的指定用户的帖子