To list the contents of the main page by the method of httpURLConnection?

I have a mission: to Determine whether a site with the given address, if there is - to list the contents of the main page. To explicitly use the GET method. How to get the page with httpURLConnection method, or MB as that of the other. Thanks in advance!
April 19th 20 at 12:17
1 answer
April 19th 20 at 12:19
URL URL = new URL("");
BufferedReader reader = new BufferedReader(new an InputStreamReader(url.openConnection().getInputStream(), "Cp1251"));
while (true) {
 String str = reader.readLine();
 if (str == null)


Find more questions by tags AndroidJava