Two things. First, add &rsz=large to your url. This will tell the API to return 
8 results at a time instead of 4. And second, rather than looking at the 
$json->responseData->cursor->moreResultsUrl, check out the 
$json->responseData->cursor->pages array. This will contain an array of the 
pages you can get. Each element in the array will have a start property which 
you can use to build a new url for the RESTful API. Simply add &start=[one of 
these start properties] to get additional sets of results. Once you've 
exhausted all the pages you can get from the pages array, then you can direct 
users to the moreResultsUrl.

Hope that makes sense!

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 Mar 24, 2010, at 2:35 AM, saravanan wrote:

> Hi,
> 
> I have currently used the following search query: i+need+an+apple.
> 
> In my test site, i am using the JSON alongwith PHP to parse the search
> results returned from Google and display them as per my need.
> 
> The problem that i face currently is that I get only top 4 results and
> get 8 page references in cursor object. I did get only one url for
> more results in "moreResultsUrl"
> 
> I want my page to be analogous to the google search page. I need more
> results and also when i click on the next links in that page, it
> should go to the next search result page.
> 
> The code i am using is as follows, This code is in PHP.
> 
> [code]
> $ct = 0;
> foreach( $json->responseData->results as $res)
> {
>       ?>
>        <h4> <a href=" <? echo $res->url ?>" target ="_blank" > <?
>               echo ($res->title); ?> </a></h4> <? echo "<br />";
>        echo $res->content."<br />";
>        ?> <a href=" <? echo $res->url ?>" target ="_blank"
> style="color:Green" > <?
>       echo ($res->url); ?> </a> <? echo "<br />";
>        echo "Cached URL: ".$res->cacheUrl."<br />";
> }
> 
> echo "<br /><br />";
> 
> foreach($json->responseData->cursor->pages as $pg)
> {
> ?> <a href=" <? echo $json->responseData->cursor->moreResultsUrl;?>"
> target="_blank" >
> <? echo $pg->label;
> ?> </a> &nbsp;&nbsp;
> <?
> }
> [/code]
> 
> Anybody please help me in getting all links in the current page and
> also tell me ways to get the link url to other search pages as like
> those in google's page.
> 
> Thanks,
> 
> saravanan
> 
> -- 
> 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