sirin k
sirin k

Reputation: 373

whats the maximum value of start parameter when communicating with google's search api in php?

This is my code

function doGoogleSearch($searchTerm,$start)
{     

    $endpoint = 'web';
    $key= '...';
    $url = "http://ajax.googleapis.com/ajax/services/search/".$endpoint;
    $args['q'] = $searchTerm;
    $args['v'] = '1.0';
    $args['rsz']=8;
    //$args['start']=8;
    $args['key']="xxx";
    $url .= '?'.http_build_query($args, '', '&');
    $url.="&start=".$start; 
    $ch = curl_init()or die("Cannot init");
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);        
    //curl_setopt($ch, CURLOPT_REFERER, $referer);
    $body = curl_exec($ch)or die("cannot execute");
    curl_close($ch);
    //decode and return the response
    return json_decode($body,1);

}

By using this code i got about 64 google results.After that i got a message like this:

Array
(
    [responseData] => 
    [responseDetails] => out of range start 
    [responseStatus] => 400
)

Is there is any way to get the all results of google?

Upvotes: 2

Views: 981

Answers (1)

sirin k
sirin k

Reputation: 373

Guys finally i got it.there is no any way to get more than 64 results from google's search api after 2006.But still there are services who can get about 1000 results because they got their api key before 2006 so they are still enjoying the service. plz read this:

http://groups.google.com/group/Google-AJAX-Search-API/browse_thread/thread/db6616286ce83ca0#

Upvotes: 2

Related Questions