Example #1
0
function getTopIGMedia($userID, $count = 10)
{
    $start = tryGET('start');
    $end = tryGET('end');
    $url = "https://api.instagram.com/v1/users/{$userID}/media/recent";
    $params = array("min_timestamp" => $start, "max_timestamp" => $end, "count" => "200", "client_id" => getIGClientID());
    $res = getAPI($url, $params);
    if (!isset($res->data)) {
        return DoNotCache();
    }
    $media = $res->data;
    usort($media, "igSort");
    $result = array();
    foreach ($media as $key => $p) {
        if ($key < $count) {
            array_push($result, $p);
        } else {
            break;
        }
    }
    return $result;
}
Example #2
0
function getTopIGMedia($userID, $count = 10)
{
    $start = tryGET('start');
    $end = tryGET('end');
    $url = "https://api.instagram.com/v1/users/{$userID}/media/recent";
    $params = array("min_timestamp" => $start, "max_timestamp" => $end, "count" => "200", "client_id" => getIGClientID());
    $res = getAPI($url, $params);
    if (!isset($res->data)) {
    }
    return null;
    // return DoNotCache("Couldn't get Instagram Media: " . json_encode($res));
    //TODO: Figure out how we can rework IG to work.
    $media = $res->data;
    usort($media, "igSort");
    $result = array();
    foreach ($media as $key => $p) {
        if ($key < $count) {
            array_push($result, $p);
        } else {
            break;
        }
    }
    return $result;
}
Example #3
0
function igStats($id)
{
    $client = getIGClientID();
    $url = "https://api.instagram.com/v1/users/{$id}";
    $params = array("client_id" => $client);
    $info = getAPI($url, $params);
    if (isset($info->curl_error)) {
        return null;
    }
    return array("followers" => $info->data->counts->followed_by);
}