import java.net.*; import java.io.*; public class proxy { public static void main(String args[]) { try { if (Class.forName( "com.ms.net.wininet.WininetStreamHandlerFactory" )!=null) URL.setURLStreamHandlerFactory(new com.ms.net.wininet.WininetStreamHandlerFactory()); } catch (ClassNotFoundException ex) { System.err.println( "Warning: WininetStreamHandlerFactory class not found."); } try { String page=args[0]; URL url=new URL(page); OutputStream out = System.out; URLConnection connection=url.openConnection(); connection.setUseCaches(true); connection.setAllowUserInteraction(true); InputStream in= connection.getInputStream(); String mimeType = connection.getHeaderField("Content-Type"); System.out.println("mime="+mimeType); byte[] buffer = new byte[4096]; int bytes_read; while((bytes_read = in.read(buffer)) != -1) { out.write(buffer, 0, bytes_read); } in.close(); } catch (Exception ex) { System.err.println(ex); ex.printStackTrace(); } } }