Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.net.URL;
- import java.net.URLConnection;
- import java.io.InputStreamReader;
- import java.io.BufferedReader;
- public class WebGet {
- public static String httpget(String location) {
- String webpage = "";
- try {
- URL url = new URL(location);
- URLConnection urlConnection = url.openConnection();
- InputStreamReader isr = new InputStreamReader(urlConnection.getInputStream());
- BufferedReader buff = new BufferedReader(isr);
- String line;
- while((line = buff.readLine()) != null) {
- webpage = webpage + line + "\n";
- }
- }
- catch(Exception e) {
- webpage = "";
- }
- return webpage;
- }
- private WebGet() {}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement