google query

D

Damo

I'm trying to query google using the URL class and appending the query
to the end of the URL :
Its returning no results, Anyone know why: this is what it looks like

public String google(String query)
{
String inputLine=null;
try {
URL google = new URL("http://www.google.com/search?q="+query);
BufferedReader d = new BufferedReader(new
InputStreamReader(google.openStream()));



while ((inputLine = d.readLine()) != null) {
System.out.println(inputLine);
}
d.close();
} catch (MalformedURLException me) {
System.out.println("MalformedURLException: " + me);
} catch (IOException ioe) {
System.out.println("IOException: " + ioe);
}
return inputLine;
}

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,056
Members
48,769
Latest member
Clifft

Latest Threads

Top