Guest User

Untitled

a guest
Mar 21st, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public static String request(String url) throws IOException{
  2.  
  3. URL obj = new URL(url);
  4. HttpURLConnection connection = (HttpURLConnection) obj.openConnection();
  5.  
  6. connection.setRequestMethod("GET");
  7.  
  8. BufferedReader in = new BufferedReader(new InputStreamReader (connection.getInputStream()));
  9. String inputLine;
  10. StringBuffer response = new StringBuffer();
  11.  
  12. inputLine = in.readLine();
  13. response.append(inputLine);
  14. in.close();
  15. String actual = response.toString().trim();
  16. return actual;
  17. }
Add Comment
Please, Sign In to add comment