diff --git a/varo/src/main/java/de/cliffbreak/varo/uitls/WebUtils.java b/varo/src/main/java/de/cliffbreak/varo/uitls/WebUtils.java new file mode 100644 index 0000000..e9e0050 --- /dev/null +++ b/varo/src/main/java/de/cliffbreak/varo/uitls/WebUtils.java @@ -0,0 +1,26 @@ +package de.cliffbreak.varo.uitls; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; + +public class WebUtils { + + public static String GET(String url) throws MalformedURLException, IOException { + HttpURLConnection connection = ((HttpURLConnection) (new URL(url)).openConnection()); + connection.setRequestMethod("GET"); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + String inputLine; + StringBuffer content = new StringBuffer(); + while ((inputLine = in.readLine()) != null) { + content.append(inputLine); + } + in.close(); + connection.disconnect(); + return content.toString(); + } + +} \ No newline at end of file