PHP-Instagram-Grabber
PHP-Instagram-Grabber copied to clipboard
Truncated answer from file_get_contents
I'm using the library to fetch content related to a hashtag. Sometimes (but not always) I get a FALSE returned. I've debugged the library and seen that the anwer from the URL opened with file_get_contents is truncated and the json_decode function cannot decode it.
Is it maybe a limitation in file_get_contents()?
Thanks for the pull request
Unfortunately it has not fixed the issue. Sometimes (also with cURL) the answer from Instagram is truncated and therefore it's an invalid JSON string.
Is it a security response from Instagram ? I don't understand what's wrong but I personnaly cannot get anymore valid request from the scrapper !
@freddurst1805 have you update the script to 1.0.10?
How can I update it directly from my project ?
if you use composer, else you have to download it yourself
I tried both with Composer & Manual, but it's still not working at all ...
I get null response for any hashtag I use
You need curl else it will return false
I use cURL in other parts of my project
have you try example.php
I use the exact same function as the hashtag test. And yes I just tried and it's the same result
The cURL request return false ( function getContentsFromUrl() )
yes because you don't have curl
protected static function getContentsFromUrl($parameters) { if (!function_exists('curl_init')) { return false; }
Why can I use cURL from other files on my server and then the module is activated ? What's the problem with cURL I don't get it ?
If you do not have cURL enabled in your host will not work @freddurst1805
Guys I have cURL installed on my local server and I use it in every project, so please ... For you everything is ok ? can you scrap by hashtag at the moment ?
Yes it works.
I get an error code 60 from cURL: CURLE_SSL_CACERT (60) Peer certificate cannot be authenticated with known CA certificates.
Adding this line seems to solve the problem:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
Now i get a code 0, so everything's fine !
Thanks fred, this works for me too