You're kidding, right? Create a URL (java.net.URL), call openConnection() to get
the a URLConnection object, then call getContent() on the URLConnection. This
method returns an object containing the contents of the URL, and in the case of
a URL to an HTML page should return a String. Hence:
URL myURL = new URL( http://www.wherever.com/whatever.html );
URLConnection myConnection = myURL.openConnection();
String myContent = (String) ( myConnection.getContent() );
Craig
******************************************
Craig Patchett <cr...@patchett.com>
The CGI/Perl Cookbook: http://cgi-perl.com
love \luv\ (v): See John 3:16
That last line gives me a java.net.UnknownHostException for whatever URL I
use. In fact, any method of URLConnection that I try to use (getContent(),
getInputStream(), etc.) gives me that exception. Must be some setting
somewhere that I'm missing that's causing all these problems.
I recommend you improve your exceptionhandler to give you back the hostname it
tries to resolve.
From the Spec:
"Thrown to indicate that the IP address of a host could not be determined." and
"UnknownHostException
public UnknownHostException(String host)
Constructs a new UnknownHostException with the specified detail message.
Parameters: host - the detail message."
It seems to be a network problem. Have you tried to set the proxy (if you are
behind a firewall), or if not to simply "ping" from your OS.
Also, try to use java.net.InetAddress to determine if and how the connection
can be made.
Regards
Dante