如何使用HttpClient的使用Post方法? [英] How to use HttpClient using Post method?

查看:92
本文介绍了如何使用HttpClient的使用Post方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用HttpClient的使用Post方法?

How to use HttpClient using Post method ?

推荐答案

请参阅上的 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();

这篇关于如何使用HttpClient的使用Post方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆