Using JavaThe following code snippet shows how to make a request to the Google Image Search API using Java. This example uses the JSON library from json.org.URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?" + "v=1.0&q=barack%20obama&userip=INSERT-USER-IP"); URLConnection connection = url.openConnection(); connection.addRequestProperty("Referer", /* Enter the URL of your site here */);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()); // now have some fun with the results...
https://developers.google.com/image-search/v1/jsondevguide?csw=1
好好看 我想这才是你需要的
"v=1.0&q=barack%20obama&userip=INSERT-USER-IP");
URLConnection connection = url.openConnection();
connection.addRequestProperty("Referer", /* Enter the URL of your site here */);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());
// now have some fun with the results...