I create a function in php. It is working currectly on localhost xamp.
function counter($search,$withKts = '0') {
$search = urlencode($search);
if($withKts) $search='"'.$search.'"';
$ch = curl_init();
$url = "http://www.google.co.in/search?q=".$search."&btnG=Search&meta=";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result=curl_exec ($ch);
$error = curl_error($ch);
$errorno = curl_errno($ch);
curl_close ($ch);
$regex = '~resultStats">\s*(.*?)\s*result~';
preg_match($regex , $result, $match);
$counts = $match[1];
$counts = str_replace("About ","", $counts);
if($counts > 1500)
return 0;
else
return $counts;
}
Here are screenshots of offline checking and online checking of same string.
And i already check the curl is enable by echo 'Curl: ', function_exists('curl_version') ? 'Enabled' : 'Disabled';
Can anyone please point what the error is?