Advertisement
Guest User

Lab3

a guest
Nov 26th, 2015
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import java.io.*;
  2. import java.net.*;
  3.  
  4. public class Lab3
  5. {
  6. public static String getHTML(String urlToRead) throws Exception
  7. {
  8. StringBuilder result = new StringBuilder();
  9.  
  10. URL url = new URL(urlToRead);
  11.  
  12. HttpURLConnection conn = (HttpURLConnection) url.openConnection();
  13.  
  14. conn.setRequestMethod("GET");
  15.  
  16. BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
  17.  
  18. String line;
  19.  
  20. while ((line = rd.readLine()) != null)
  21. {
  22. result.append(line);
  23. }
  24. rd.close();
  25. return result.toString();
  26. }
  27.  
  28. public static void main(String[] args) throws Exception
  29. {
  30. System.out.println(getHTML("http://http://136.206.115.117:8080/IRModelGenerator/SearchServlet?query=bonediseasesimf=BM25k=1.2b=0.75numwanted=50"));
  31.  
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement