If you echo $url, what is it requesting? And does it work as a standalone url 
in the browser?

Jeremy R. Geerdes
Effective website design & development
Des Moines, IA

For more information or a project quote:
http://jgeerdes.home.mchsi.com
[email protected]

If you're in the Des Moines, IA, area, check out Debra Heights Wesleyan Church!

On Apr 7, 2010, at 8:00 PM, Dave wrote:

> Hmm.  So, I've been at this for a while and not sure what is wrong.
> For some reason, the 2 parameters "start" and "rsz" don't seem to be
> working.
> 
> Here is what my code looks like, more or less...
> 
> ----------
>    $url = "http://ajax.googleapis.com/ajax/services/search/web?
> v=1.0&"
>    . "start=$i&rsz=large&q=$query&key=$key&userip=
> $_SERVER[REMOTE_ADDR]";
> 
>    // sendRequest
>    // note how referer is set manually
>    $ch = curl_init();
>    curl_setopt($ch, CURLOPT_URL, $url);
>    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
>    curl_setopt($ch, CURLOPT_REFERER, $url);
>    $body = curl_exec($ch);
>    curl_close($ch);
> 
>    // now, process the JSON string
>    $json = json_decode($body);
>    // now have some fun with the results...
> 
>    echo "$i. ".$json->responseData->results[0]->unescapedUrl."\n";
>    echo $json->responseData->results[1]->unescapedUrl."\n";
>    echo $json->responseData->results[2]->unescapedUrl."\n";
>    echo $json->responseData->results[3]->unescapedUrl."\n";
> -------
> 
> I have the above code in a loop, were $i is incrementing.  However, no
> matter what value $i is, I'm getting the same results back.  Also, in
> the result, pages->start is always 0.
> 
> What am I doing wrong?  :|
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Google AJAX APIs" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/google-ajax-search-api?hl=en.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Google AJAX APIs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-ajax-search-api?hl=en.

Reply via email to