title: java URLConnection to http URL and extracting XML response
body: <p>I have a rest http URL from which I have to extract the XML response. When I browse the URL using a browser, it returns html content. My code also sees the same html content instead of XML content. </p>
  
  <p>Is there a way to get the XML content instead of html content? In the below code, I am getting only the html response. But if I check with postman plugin in chrome it shows a nice XML response. How do I get the same response using my code.</p>
  
  <pre><code>public static void sendURL(String urlValue)throws Exception{
      URL oracle = new URL("https://whois.arin.net/rest/asn/AS2639");
  
      URLConnection yc = oracle.openConnection();
  
      yc.setRequestProperty("content-type", "application/xml");
      BufferedReader in = new BufferedReader(new InputStreamReader(
                                  yc.getInputStream()));
      String inputLine;
      while ((inputLine = in.readLine()) != null) 
          System.out.println(inputLine);
      in.close();
  }
  </code></pre>