connection.setDoOutput(true);
最后,為了得到OutputStream,簡單起見,把它約束在Writer并且放入POST信息中,例如:
...
OutputStreamWriter out = newOutputStreamWriter(uc.getOutputStream(), "8859_1");
out.write("username=bob&password="+password+"");
// remember to clean up
out.flush();
out.close();
這樣就可以發送一個看起來象這樣的POST:
文章來源于領測軟件測試網 http://www.kjueaiud.com/