A URLConnection for an http URL will set up the request
line and the MIME header for you as long as you
doOutput field to true by
If you also want to read from the connection, you
doInput to true with
URLConnection uc = u.openConnection(); uc.setDoOutput(true); uc.setDoInput(true);
The request line and MIME header are sent as soon as the URLConnection connects.
getOutputStream() returns an output stream
on which you can write the x-www-form-urlencoded name-value pairs.