package ohjava;

import java.net.*;
import java.io.*;

public class WebAccess {

   public static String getHTMLContent(String urlString) {
     URL hp;
     try {
       hp = new URL(urlString);
     } catch (java.net.MalformedURLException e) {
         return "";
       }
     URLConnection hpCon;
     try {
       hpCon = hp.openConnection();
     } catch (java.io.IOException e) {
         return "";
       }
     InputStream s;
     try {
       s = hp.openStream();
     } catch (java.io.IOException e) {
        return "";
       }
     BufferedReader data = new BufferedReader (
       new InputStreamReader(s));
     String line, sHtml="";
     try {
       line = data.readLine();
     } catch (java.io.IOException e) {
         return "";
       }
     while (line != null) {
       sHtml += line + "\n";
       try {
         line = data.readLine();
       } catch (java.io.IOException e) {
           return "";
         }
     }
     try {
       data.close();
     } catch (java.io.IOException e) {
         return "";
       }
     return sHtml;
   }
}