gpt4 book ai didi

java - 读取代理java背后的https网页数据

转载 作者:行者123 更新时间:2023-11-29 04:04:40 26 4
gpt4 key购买 nike

我想阅读安全网页数据说 https://www.paypal.com ,我在代理后面。我试过

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);

我一直收到 UnknownHostException,我正在通过 http 网站成功获取数据。我错过了什么吗?

谢谢,罗希特

最佳答案

您的 proxyHost 设置中有 3 个 T,即您使用的是 https 而不是 https

关于java - 读取代理java背后的https网页数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/801908/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com