import java.net.*;
import java.util.*;
import java.io.*;

/***
 * A tiny web page getter
 * This grabs the HTML page from a web server and prints it to std out
 * @author Mitch Fincher , 2000
**/
public class GetWebPage {


public static void main(String args[])
  {
    String line = null;
    if(args.length < 1) {
	System.out.println("usage: GetWebPage <url>");
	System.out.println("   example: GetWebPage http://www.cnn.com");
	System.exit(1);
    }
    URLConnection uc = null;
    try {
	uc = new URL(args[0]).openConnection();
	BufferedReader sin = new BufferedReader(new InputStreamReader(uc.getInputStream()));
	while((line = sin.readLine()) != null) {
	    System.out.println(line);
	}
	 sin.close();
    }
    // try
    catch (Exception ex)
	{ 
	    System.out.println("Exception thrown: " + ex);
	    ex.printStackTrace(System.out); 
	}
  }
} // class GetWebPage

