How to send a simple POST request to a web server?
I would appreciate any example that shows how to make a connection to a web server and send a POST request. I can easily send a GET request, but I am failing sending a POST request. Please advise.
Here is what I tried:
1. Create HttpURLConnection, open OutputStream and write the data. Failed, because the server never got the data.
2. Create a socket connection and write the headers and data to the stream. Failed, because the server refused connection.
Maybe I am doing something wrong...