I want to get the HTML from a website, for that I'm using this code. When I try to add this code from the documentation I get this error:
//Get HTML
URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
readStream(in);
finally {
urlConnection.disconnect();
}
}
What went wrong? Did I forget to import some stuff?