正如标题所述,我正在尝试使用URLConnection简单地向when服务器发送一个HTTP请求,但是当我尝试运行脚本时,它不会发送请求,也不会给我一个错误。
代码:
public static URLConnection connection;
new URL("http://website.com/dostuff.php?whatever=" + whatever).openConnection();发布于 2013-07-23 04:27:59
URL.openConnection不会立即创建连接。只有在您调用需要连接的方法之后,它才会连接。例如:
URL url = ...;
InputStream in = url.openStream(); // connection happens here
// you can now read the output from inhttps://stackoverflow.com/questions/17796746
复制相似问题