Home | Projects | Tutorials | Articles | live chat | Submit Project | Big Vote
 
Ajax Projects
.NET Frameworks
Java Frameworks
PHP Frameworks
Ruby Frameworks
Other Frameworks
Cool AJAX sites
Ajax Resources
Ajax Tools
JavaScript frameworks

 Home /  Tutorials / Google Search Api Java

Google Search Api Java





In this tutorial you will know how to Call Google AJAX Search API from Java by using this code:

Read The Full Tutorial.
































In this tutorial you will know how to Call Google AJAX Search API from Java by using this code:

import java.io.*;
import java.net.*;

public class GoogleAJAXSearchAPI {
    private static String endpointURL = "http://www.google.com/uds/GwebSearch?"+
          "callback=GwebSearch.Raw" +
          "Completion&context=0&lstkp=0&rsz=small&hl=en&" +
          "sig†56f49c146c5220e273d16b4b6978b2&q=Axis2&key=xxxxxxxxxxxxxxxxxx&v=1.0";

    public static void main(String[] args) throws Exception {
        URLConnection uc = new URL(endpointURL).openConnection();
        HttpURLConnection connection = (HttpURLConnection) uc;
        connection.setDoOutput(true);
        connection.setRequestMethod("GET");
        connection.connect();
        
        String line;
        InputStream inputStream = null;
        try {
            inputStream = connection.getInputStream();
        } catch (IOException e) {
            inputStream = connection.getErrorStream();
        }
        BufferedReader rd = new BufferedReader(new InputStreamReader(inputStream));
        while ((line = rd.readLine()) != null) {
            System.out.println(line);
        }
    }
}
 
AddThis Social Bookmark Button
Top Projects
MSN Web Messenger
MessengerFX
ebuddy
e-messenger
ILoveIM
You Tube
AJAX file upload
KoolIM.com
Meebo
Ajax.NET Professional
Tutorials
Ajax Menu Examples
How To Create Your First AJAX and PHP Contact Form
Find the JavaScript framework with WTFramework
How To Add a CalendarExtender To a GridView
PageMethods is undefined error using AJAX ASP.NET
A simple Ajax JSF 2.0 example
Bitkraft Project - Using Custom Classes
jQuery Image Cloning Script
A Primer on Microsoft Atlas
Declarative Syntax for Widgets