4.7.3 Using URLs and URLConnection
Based on the Javasoft URL
tutorial.
Using URL to post is relatively simple.
- Create a URL.
- Open a connection to the URL.
- Set output capability on the URLConnection.
- Get an output stream from the connection. This output stream is
connected to the standard input stream of the cgi-bin script on the
server. Its probably convenient to ensure that this is a PrintWriter.
- Write to the output stream.
- Close the output stream.
- Get the input stream from the connection.
- Read from the input stream, again probably easiest as a BufferedReader.
And here is an answer
Ian Wakeman
2005-02-22