Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncated answer from file_get_contents #23

Open
paha77 opened this issue Oct 25, 2016 · 21 comments
Open

Truncated answer from file_get_contents #23

paha77 opened this issue Oct 25, 2016 · 21 comments

Comments

@paha77
Copy link

paha77 commented Oct 25, 2016

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()?

@Bolandish
Copy link
Owner

Thanks for the pull request

@paha77
Copy link
Author

paha77 commented Nov 8, 2016

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.

@freddurst1805
Copy link

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 !

@Vassard
Copy link
Collaborator

Vassard commented Nov 24, 2016

@freddurst1805 have you update the script to 1.0.10?

@freddurst1805
Copy link

How can I update it directly from my project ?

@Vassard
Copy link
Collaborator

Vassard commented Nov 24, 2016

if you use composer, else you have to download it yourself

@freddurst1805
Copy link

I tried both with Composer & Manual, but it's still not working at all ...

@freddurst1805
Copy link

I get null response for any hashtag I use

@Vassard
Copy link
Collaborator

Vassard commented Nov 24, 2016

You need curl else it will return false

@freddurst1805
Copy link

I use cURL in other parts of my project

@Vassard
Copy link
Collaborator

Vassard commented Nov 24, 2016

have you try example.php

@freddurst1805
Copy link

I use the exact same function as the hashtag test. And yes I just tried and it's the same result

@freddurst1805
Copy link

The cURL request return false ( function getContentsFromUrl() )

@Vassard
Copy link
Collaborator

Vassard commented Nov 24, 2016

yes because you don't have curl
protected static function getContentsFromUrl($parameters) { if (!function_exists('curl_init')) { return false; }

@freddurst1805
Copy link

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 ?

@leonelfolmer
Copy link

If you do not have cURL enabled in your host will not work @freddurst1805

@freddurst1805
Copy link

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 ?

@paha77
Copy link
Author

paha77 commented Nov 27, 2016

Yes it works.

@freddurst1805
Copy link

I get an error code 60 from cURL:
CURLE_SSL_CACERT (60)
Peer certificate cannot be authenticated with known CA certificates.

@freddurst1805
Copy link

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 !

@ivanckt
Copy link

ivanckt commented Dec 23, 2016

Thanks fred, this works for me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants