eyecatchup / SEOstats

SEOstats is a powerful open source PHP library to request a bunch of SEO relevant metrics.
MIT License
1.46k stars 383 forks source link

Results are not being fetched in get-google-serps.php (Probably google blocking the script) #111

Open rizwan95 opened 8 years ago

rizwan95 commented 8 years ago

Hello,

The library works fine for everything excpet get-google-serps.php

The results are not being fetched and hence no data are being shown. And I tried to test the code and I put the following code echo $info['http_code']; echo $result; return ($info['http_code']!=200) ? false : $result;

in gcurl function in Services.php and I got the result as 302 permanently moved.

rizwan95 commented 8 years ago

I think google is blocking the serp script.

hughsaffar commented 8 years ago

Probably your IP has been blocked by the Google due to number of the request you've sent to their API! You need to use proxies when sending lots of request back to back to a website like Google.

rizwan95 commented 8 years ago

How do I do that ?

hughsaffar commented 8 years ago

Dig into the method do the call. I checked it while back and it was sending the request via CURL. You need to add CURLOPT_PROXY in your options and define your proxies. However, you need to come up with a solution to rotate the proxies otherwise that one will be blocked too. More info about CURL options at http://php.net/manual/en/function.curl-setopt.php

rizwan95 commented 8 years ago

Thank you so much for the solution will try it and get back to you.

tholu commented 8 years ago

See also my current pull request: https://github.com/eyecatchup/SEOstats/pull/129 - this should also fix this issue here.