Get the content of a website (http) as a string
A very useful thing is to read the content of a website. That means, reading the sourcecode, the html code of that site. It can be of any type!
Here is a code example of a function, where you can enter the URL of the website, and it will return the content as a string, with the right breaks "\n"'s at the end of the line:
String getWebsiteContent(String websiteurl) {
  String document_content = "";
    try {
      URL url = new URL("");
      BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
      String str;
      while ((str = in.readLine()) != null)
  catch (MalformedURLException e) {}
  catch (IOException e) {}
  return document_content.substring(1);

Don't forget the right imports!
admin / Dec 05, 2004
2004 - 2019 /