I was trying to fetch data from google search. I used the below code
$curl = curl_init();
curl_setopt ($curl, CURLOPT_URL, "http://www.google.com/search?output=toolbar&q=".urlencode($fkey));
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
$contentstring = curl_exec ($curl);
curl_close ($curl);
print $contentstring;
But its not displaying the page like below
Please somebody help me to solve this... Thanks in advance
Your code is working pretty fine.
As you can see the image.. Google have blocked the request from your IP address as it detected unusual traffic activity.
You can always check the HTTP Status Code what your requesting URL gives by..
echo $http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
If everything is normal , you would get a 200
response, else you will get some other status code.
Here are the most common HTTP Status Codes..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With