Hi, Thank you very much for your reply. I have one another small query to be clarified by you. In the bottom of the page, we give the links as 1 2....n.
You have suggested appending of the &start to the url of the query. Shall i use the url as "http://www.google.co.in/search? hl=en&rsz=large&q=i+need+an+apple&start=".$pg->start" or have i got to use the initial url like "http://ajax.googleapis.com/ajax/services/ search/web?v.....". where the $pg-> start is getting the value of the start property from the object $json->responseData->cursor->pages. Please suggest me. Further, google search url is like this "http://www.google.co.in/ search?hl=en&rlz=1C1DVCC_enIN361IN361&q=i+need+an +apple&start=20&sa=N". Can you tell me the meaning of the "rlz" and &sa=N in the above URL. This for my knowledge only. Thank you.. On Mar 24, 9:29 pm, Jeremy Geerdes <[email protected]> wrote: > 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> > > <? > > } > > [/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 > > athttp://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.
