Hello

I'm triying to use Google Search API with Java, i have correct key but
the query only return my 4 results.

For example:

https://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=HELLOWORLD&key=MYKEY

¿How can i obtain all results?

I do this in Java:

        URL url = new URL(
                            "https://ajax.googleapis.com/ajax/services/
search/web?" +
                            "v=1.0&q=HELLOWORLD" +
                            "&key=" + sMyKey
                         );

        URLConnection connection = url.openConnection();
        connection.addRequestProperty("Referer", "http://
fake.sisob.es/");

        String line;
        StringBuilder builder = new StringBuilder();
        BufferedReader reader =
        new BufferedReader(new
InputStreamReader(connection.getInputStream()));
        while((line = reader.readLine()) != null) {
         builder.append(line);
        }

        JSONObject json = new JSONObject(builder.toString());
        JSONArray ajson = (JSONArray)
((JSONObject)json.get("responseData")).get("results");

        for(int i = 0; i < ajson.length(); i++)
        {
 
System.out.println(((JSONObject)ajson.get(i)).get("url").toString());
        }

-- 
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