title: How to get a web page content in Android ?
body: <p>I have a problem to get a web page content in my Android App. I would like to read the contents from this address <a href="https://szr.szczecin.pl/utms/data/layers/VMSPublic" rel="nofollow">https://szr.szczecin.pl/utms/data/layers/VMSPublic</a> . </p>
  
  <p>At first I tried to do it in Java using this code:</p>
  
  <pre><code>public class Main {
  
      public static void main(String[] args) {
  
          String https_url = "https://szr.szczecin.pl/utms/data/layers/VMSPublic";
          URL url;
          try {
  
              url = new URL(https_url);
              HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
              print_content(con);
  
          } catch (MalformedURLException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  
      private static void print_content(HttpsURLConnection con) {
          if (con != null) {
  
              try {
  
                  System.out.println("****** Content of the URL ********");
                  BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
  
                  String input;
  
                  while ((input = br.readLine()) != null) {
                      System.out.println(input);
                  }
                  br.close();
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
  
          }
  
      }
  
  }
  </code></pre>
  
  <p>It worked after I downloaded and installed the certificate from that webpage. How can I do the same in Android?  I tried HTTPSURLConnection in Android but it returns me only the address of the web page. When I was trying HTTPURLConnection it gives me an information that document was moved (status 302).  </p>