Instagram-PHP-API icon indicating copy to clipboard operation
Instagram-PHP-API copied to clipboard

getTagMedia fails because of default hardcoded 0 value in arg

Open kareemareola opened this issue 9 years ago • 11 comments

the getTagMedia function has a hardcoded limit of 0 by default. This causes an error when the function is called. Suggestion is to change the argument passed to the function to a value such as $mediaLimit earlier in the code so that it can be manipulated easily in the future.

kareemareola avatar Apr 07 '15 14:04 kareemareola

Thanks for reaching out. This will be fixed when #119 gets merged.

vinkla avatar Apr 07 '15 14:04 vinkla

I confirm the problem about getTagMedia function.

frafra85 avatar Apr 07 '15 15:04 frafra85

getTagMedia() Change $auth to true in _makeCall and check pls other auth methods

https://instagram.com/developer/endpoints/tags/

imonly avatar Apr 08 '15 11:04 imonly

@imonly Could you please describe a little more why we should change the default $auth parameter to true? Maybe its better to specify this for each individual request instead. For example; we should add it here: https://github.com/cosenary/Instagram-PHP-API/blob/master/src/Instagram.php#L304

vinkla avatar Apr 08 '15 11:04 vinkla

https://github.com/cosenary/Instagram-PHP-API/blob/master/src/Instagram.php#L317 $auth == false but in documentation need access_token : https://api.instagram.com/v1/tags/{tag-name}/media/recent?access_token=ACCESS-TOKEN

imonly avatar Apr 08 '15 12:04 imonly

Yeah, we should fix this. Maybe you could create a pull request and fix this for all methods that need the authentication?

vinkla avatar Apr 08 '15 12:04 vinkla

Sorry, but I have no time for it And also, it would be nice if you could set up a job with the api so that did not need to reinvent the wheel when you want to Ajax requests to the api, in the comments there is a very sensible idea of passing parameters to the method https://gist.github.com/cosenary/2961185#comment-803467

imonly avatar Apr 08 '15 12:04 imonly

@imonly Okay. Maybe you could create a second thread concerning the job issue?

vinkla avatar Apr 08 '15 12:04 vinkla

Seems like others, #121 and #122, also are experiencing this issue. We need to address this asap.

vinkla avatar Apr 09 '15 18:04 vinkla

Like just said in #121

I managed to get my code running with a quick fix like the following

public function getUserFeed($limit = 0) {
        if($limit>0) {
            return $this->_makeCall('users/self/feed', true, array('count' => $limit));
        }else{
            return $this->_makeCall('users/self/feed', true);
        }

It isn't pretty but it work fine without having to edit the methods call. Instagram now ask for either a count parameter over 0 or no count parameter at all. I figured it was the best way to deal with it will we figure a way to solve it properly.

ghost avatar Apr 10 '15 18:04 ghost

Is this fix pushed to master? I am still getting this error....

morales2k avatar Sep 09 '15 20:09 morales2k