如何使用Post方法使用HttpClient?

时间:2011-03-24 06:20:15

标签: android

如何使用Post方法使用HttpClient?

2 个答案:

答案 0 :(得分:3)

查看DefaultHttpClient班级和HttpPost班级

上的文档
HttpClient client = new DefaultHttpClient();
HttpPost post = new HttpPost("http://your.site/your/service");
// set some headers if needed
post.addHeader(....);
// and an eclosed entity to send
post.setEntity(....);
// send a request and get response (if needed)
InputStream responseStream = client.execute(post).getEntity().getContent();

答案 1 :(得分:2)

在这里你可以得到一个很好的例子Executing a HTTP POST Request with HttpClient