ulmaxy ulmaxy -5 years ago 262
Java Question

Send HTTP POST request to destination by IP address in java

I have an Apache web server launched at another computer in my local network, that have a .php file in its root folder, so I can send my requests from browser using addresses like "". I really need to do that from my java code, which is kind of confusing for me. Since I'm using IP address, I can't use HttpUrlConnection to send my requests because it requires to have a URL. Is there something similar to HttpUrlConnection but for IP addresses?

Answer Source

HttpUrlConnection can be perfectly used for both hostname HTTP connections and for IP address HTTP connections:

HttpURLConnection conn = (HttpURLConnection) new URL("").openConnection();
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download