import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
public class WebCapturer {
public static void main(String[] args) throws Exception {
URL url = new URL("http://www.google.com.hk/search?q=biao");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent", // 很重要
"Mozilla/5.0 (X11; U; Linux i686; zh-CN; rv:1.9.1.2) "
+ " Gecko/20090803 Fedora/3.5.2-2.fc11 Firefox/3.5.2");
conn.setRequestMethod("GET");
Scanner scanner = new Scanner(conn.getInputStream());
while (scanner.hasNextLine()) {
System.out.println(scanner.nextLine());
}
}
}