Posted By

mouseroot on 11/08/10


Tagged


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

nicc777


Java Read site source line by line


 / Published in: Java
 

Java Read Site Source code Line by Line :D

  1. import java.net.*;
  2. import java.io.*;
  3.  
  4. class ...
  5.  
  6. static URL url;
  7. static URLConnection urlc;
  8. static BufferedReader br;
  9. static String line;
  10.  
  11. ... public static void main(String args[])
  12.  
  13. try {
  14.  
  15. url = new URL("Http://website.tld");
  16. urlc = url.openConnection();
  17. br = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
  18. while((line = br.readLine()) != null)
  19. {
  20. System.out.println(line);
  21. }
  22.  
  23. } catch(Exception e) {
  24. System.out.println("There was an error in your URL!");
  25. }

Report this snippet  

You need to login to post a comment.