Connection URL
Hi,
I'm doing a program to return a keyword search page from google. In the program below the output will be the code of the page (e.g. using the keyword "water"). The problem is that what I want for the output is only the links in separate lines.
How can I do that? Regular Expressions or is there a better method?
Your help will be very useful for me. :-)
Thanks in advance
mp
import java.net.*;
public class ReadGoogle {
public static void main(String[] args) throws Exception {
URL google = new URL("http://www.google.pt/search?hl=pt-PT&q=water&meta=");
BufferedReader in = new BufferedReader(new InputStreamReader(google.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}
}
|