0

我正在HttpUrlConnection使用URL. 在浏览器URL中给我响应,但在下面的代码中InputStream响应是0. 为什么?

这是我的代码:

URL url = new URL("https://certify.securenet.com/payment.scrnt");

HttpURLConnection httpCon = (HttpURLConnection)url.openConnection();
InputStream in = httpCon.getInputStream();

byte content[] = new byte[in.available()];
in.read(content, 0, content.length);
String receivedString = new String(content);
Log.d("Received String", receivedString)
4

2 回答 2

2

如果您不需要安全连接,请尝试将 URL 中的“https://”更改为“http://”。
或者尝试更改为 HttpsUrlconnection 而不是 HttpUrlconnection。

于 2010-10-14T18:09:14.247 回答
0

我想您必须使用HttpsUrlConnection带有https方案的 URL。

于 2010-10-14T18:04:26.607 回答