23 November 2010

URLReader - java

URLReader ด้วย java อ่าน HTML code จากเว็บ
import java.net.*;
import java.io.*;
public class URLReader  {
    public static void main(String[] args) throws Exception {
        URL url = new URL("http://www.google.com");
        BufferedReader in = new BufferedReader(
        new InputStreamReader(
        url.openStream()));
        String inputLine;
        while ((inputLine = in.readLine()) != null)
        System.out.println(inputLine);
        in.close();
    }
}

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Blog by Chagridsada Boonthus | http://chagridsada.blogspot.com/