Trying to call an API URL from a Java application, I'm having problems accessing the contents of the URL. I can access other sites through my program but not the Stack Exchange site. But I can call the URL directly from the browser and get data. This is my program and output is in encrypted form. I want to get in a normal format. import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.io.BufferedReader; public class URLServlet { public static void main(String[] args) { try { URL urldemo = new URL("http://api.stackexchange.com/2.1/questions/1346?site=health.stackexchange.com&filter=withbody"); URLConnection yc = urldemo.openConnection(); yc.setDoOutput(true); System.out.println(yc.getContent()); BufferedReader in = new BufferedReader(new InputStreamReader( yc.getInputStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); }catch(Exception e) { System.out.println(e); } System.out.println("hello world"); } }