开发者

How to use HttpClient using Post method?

开发者 https://www.devze.com 2023-02-19 04:31 出处:网络
How to开发者_开发知识库 use HttpClient using Post method ?See a docs on DefaultHttpClient class and HttpPost class

How to开发者_开发知识库 use HttpClient using Post method ?


See a docs on DefaultHttpClient class and HttpPost class

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();


here you can get an good example Executing a HTTP POST Request with HttpClient

0

精彩评论

暂无评论...
验证码 换一张
取 消