cosenary / Instagram-PHP-API

An easy-to-use PHP Class for accessing Instagram's API.
http://cosenary.github.com/Instagram-PHP-API
BSD 3-Clause "New" or "Revised" License
1.46k stars 781 forks source link

Sending multiple parameters #179

Open nWidart opened 8 years ago

nWidart commented 8 years ago

Hello,

I would like to send more custom parameters to the getUserMedia() method. For this I changed that method to the following:

public function getUserMedia($id = 'self', array $params)
{
    return $this->_makeCall('users/' . $id . '/media/recent', strlen($this->getAccessToken()), $params);
}

This enables me to send in an array of possible parameters, like for instance the timestamp limits:

$media = $this->instagram->getUserMedia('self', [
    'MAX_TIMESTAMP' => $this->getToDate()->timestamp,
    'MIN_TIMESTAMP' => $this->getFromDate()->timestamp,
]);

Although the url is correct, it doesn't get the limited data in that date range. This is the URL:

https://api.instagram.com/v1/users/self/media/recent?access_token=MY_TOKEN&MAX_TIMESTAMP=1446537600&MIN_TIMESTAMP=1446451200

Did I miss something that might cause this behaviour ?

Thanks,

vinkla commented 8 years ago

Everything seems fine. What error is it returning?

nWidart commented 8 years ago

There is no returned error, just that it is not filtering data based on those 2 dates. When I limit it to the previous day only, I still get the full number of results that instagram profile has, instead of like 2-3 images posted on that day.

vinkla commented 8 years ago

Does the timestamp you send and the timestamp it returns look the same?

nWidart commented 8 years ago

They are the same yes.

What I send:

// $paramString, in _makeCall()
"&MAX_TIMESTAMP=1446537600&MIN_TIMESTAMP=1446451200"

And next_url from the pagination key:

https://api.instagram.com/v1/users/198152435/media/recent?MIN_TIMESTAMP=1446451200&sig=TOKEN&MAX_TIMESTAMP=1446537600&access_token=TOKEN&max_id=1047160062405383159_198152435

The min and max timestamp correspond.

vinkla commented 8 years ago

That is definitely strange. I guess this is out of my knowledge of the API. Sorry I can't help more.