tags:

views:

313

answers:

1

Hi,

I want to read a secure webpage data say https://www.paypal.com, i am behind proxy. I tried with

System.setProperty("java.net.useSystemProxies","true");
System.setProperty("htttps.proxyHost","myproxyhost");
System.setProperty("https.proxyPort","443");

URL u = new URL("https://www.paypal.com");
URLConnection uc = u.openConnection();
uc.setDoOutput(true);

StringBuffer sbuf=new StringBuffer();
BufferedReader in = new BufferedReader(
new InputStreamReader(uc.getInputStream()));

String res = in.readLine();
System.out.println(" Response from paypal "+res);
while ((res = in.readLine()) != null){
       sbuf.append(res).append(",");
}
in.close();

System.out.println(" Total Data received  "+sbuf);

i am getting UnknownHostException all the time, I am successfully fetching data with http websites. Am i missing something?

Thanks, Rohit

+5  A: 

You've got 3 T's in your proxyHost settings, i.e. you are using htttps rather than https.

A_M
Good catch. ___
Don Branson