Hello,

I am trying to code a program, which shows the details of a webpage,
it is almost showing everything except the content,

any one please help me to get the content of the webpage also,

below is my code..
Java Code:
import java.net.*;
import java.io.*;
import java.util.Date;

public class URLInfo{
  public static void main(String args[]) throws Exception {
    int c;
    URL url = new URL("some url with page name"); //could not write any live url here
    URLConnection con = url.openConnection();
    System.out.println("");
    System.out.println("Date: " + new Date(con.getDate()));
    System.out.println("Content-Type: " + con.getContentType());
    System.out.println("Expires: " + con.getExpiration());
    System.out.println("Last-Modified: " + new Date(con.getLastModified()));
    int len = con.getContentLength();
    System.out.println("Content-Length: " + len);
    if (len > 0) {
      System.out.println("=== Content ===");
      InputStream input = con.getInputStream();
      int i = len;
      while(((c = input.read()) != -1) && (-i > 0)) {
        System.out.print((char) c);
      }
      input.close();
    }
    else {
        System.out.println("No Content Available");
      }
  }
}

it is showing below for the content...
Content-Length: -1
No Content Available



Thanks
- /\/