Performing HTTP POST in JAVA

Posted:
Sat Aug 16, 2008 9:46 am
by vivekn
How do you perform a POST request in java using HttpURLConnection,please give an example
i want to submit form data directly to a script thru java
Thanks in advance
Re: Performing HTTP POST in JAVA

Posted:
Mon Aug 18, 2008 7:36 am
by nathandelane
http://www.exampledepot.com/egs/java.net/Post.htmlThe above link shows an example of how to do this in Java. Writing POST data must be done over a stream in Java, which is where this part comes in:
- Code: Select all
...
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write(data);
wr.flush();
...