Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static String request(String url) throws IOException{
- URL obj = new URL(url);
- HttpURLConnection connection = (HttpURLConnection) obj.openConnection();
- connection.setRequestMethod("GET");
- BufferedReader in = new BufferedReader(new InputStreamReader (connection.getInputStream()));
- String inputLine;
- StringBuffer response = new StringBuffer();
- inputLine = in.readLine();
- response.append(inputLine);
- in.close();
- String actual = response.toString().trim();
- return actual;
- }
Add Comment
Please, Sign In to add comment