Results 1 to 1 of 1
- 10-04-2007, 09:31 PM #1
How to read a Web Page through java program
This example code will read the Google and print its source to the console.
Java Code:import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class URLExp { public static void main(String[] args) { try { URL google = new URL("http://www.google.com/"); URLConnection yc = google.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(yc .getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) { System.out.println(inputLine); } in.close(); } catch (Exception e) { e.printStackTrace(); } } }
Similar Threads
-
help to read .pst file through java
By umadas in forum Advanced JavaReplies: 2Last Post: 12-19-2010, 04:32 AM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
How to read a Web Page through java program
By Java Tip in forum java.netReplies: 0Last Post: 04-04-2008, 02:37 PM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM -
Some form to read pixels in Java and to handle Another plate VGA?
By Albert in forum Advanced JavaReplies: 1Last Post: 06-07-2007, 05:29 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks