As the title states, I'm attempting to simply send a HTTP request to a webserver with URLConnection, but when I attempt to run the script, it does not send the request, nor does it give me an error.
Code:
public static URLConnection connection;
new URL("http://website.com/dostuff.php?whatever=" + whatever).openConnection();
URL.openConnection
does not create the connection immediately. It only connects after you call a method that requires a connection. For example:
URL url = ...;
InputStream in = url.openStream(); // connection happens here
// you can now read the output from in
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.