I'm trying to learn how to download images and files from a website trough a java program. The code below is copied from Reading Directly from a URL (The Java™ Tutorials > Custom Networking > Working with URLs). This program is supposed to display the html file code from the url provided.
Quoted from the site:"When you run the program, you should see, scrolling by in your command window, the HTML commands and textual content from the HTML file located at Oracle | Hardware and Software, Engineered to Work Together. "
My problem is that it works for some websites, but not for interfacelift.com. It doesn't display anything for that website. I'm trying to figure out why.
import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL oracle = new URL("http://interfacelift.com/"); BufferedReader in = new BufferedReader( new InputStreamReader(oracle.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }