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 782 forks source link

Connect timed out? #194

Closed RobWiddick closed 8 years ago

RobWiddick commented 8 years ago

Error: _makeCall() - cURL error: Failed to connect to api.instagram.com port 443: Connection timed out

Does anyone know why this could be happening? The first few requests work, then it times out..

RobWiddick commented 8 years ago

I believe I have successfully implemented a resolution to this.

For some reason, when using the API heavily (such as during loops), the connection likes to fail: either by timing out or "connection refused". I have no idea why - and Instagram isn't offering any help.

I have also reordered the way that the headers are handled post-execution, so that the returned data is checked before parsed (such as before the processHeaders method). I've introduced a second exception to help developers track down issues easier, albeit ever so slightly... at least we'll know that the connection failed (for whatever reason) X times instead of just giving up once.