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:
文章来源于领测软件测试网 https://www.ltesting.net/