I am out of ideas and really need help on this one...

I need to access a URL from an application and capture the
output for further processing by the application.

I thought I could do something like:

String input;
URL url = new URL("the url here");
Object content = url.openConnection().getContent();
DataInputStream in = new DataInputStream((BufferedInputStream)content);
while((input = in.readLine()) != null) System.out.println(input);

This works great with static pages where the url refers to an existing
.html file, but returns:

java.net.SocketException: Socket closed

And if I use the simpler approach to open the stream via:

URL url = new URL("the url here");
DataInputStream in = new DataInputStream(url.openStream());
while((input = in.readLine()) != null) System.out.println(input);

I get the exception: java.io.FileNotFoundException: ...url listed...

I have actually cut and paste the url listed in the exception listed above
in a browser to make sure it just isn't a typo.

I am out of ideas and hope someone has done this before.

TIA

Frank Morton
[EMAIL PROTECTED]





-- --------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
READ THE FAQ!!!!     <http://java.apache.org/faq/>
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to