google search engine api not produce exact live search
Posted
by Bharanikumar
on Stack Overflow
See other posts from Stack Overflow
or by Bharanikumar
Published on 2010-06-14T07:19:21Z
Indexed on
2010/06/14
7:22 UTC
Read the original article
Hit count: 290
Hi ,
The google search engine api not render the first result ,
Example,
function google_search_api($args, $referer = 'http://localhost/test/', $endpoint = 'web'){
$url = "http://ajax.googleapis.com/ajax/services/search/".$endpoint;
if ( !array_key_exists('v', $args) ) $args['v'] = '1.0';
$url .= '?'.http_build_query($args, '', '&');
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // note that the referer must be set curl_setopt($ch, CURLOPT_REFERER, $referer); $body = curl_exec($ch); curl_close($ch); //decode and return the response return json_decode($body); }
$rez = google_search_api(array(
'q' => 'dl03', ));
print_r($rez);
the result for the above snippet little differ compare to live google search,
the above snippet not render first result ,
that is in google live search first result not displaying the above snippet ,
AMy i know, what should i have to do now,
Regards
© Stack Overflow or respective owner