ROhit
ROhit

Reputation:

Reading https web page data behind proxy java

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

Upvotes: 1

Views: 2368

Answers (1)

A_M
A_M

Reputation: 7851

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

Upvotes: 4

Related Questions