2个回答
展开全部
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("你要post的地址");
httpPost.setHeader("Content-type", "application/json"); //header设置
Entity entity = new StringEntity(json, "utf-8");
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
HttpPost httpPost = new HttpPost("你要post的地址");
httpPost.setHeader("Content-type", "application/json"); //header设置
Entity entity = new StringEntity(json, "utf-8");
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
将你的问题直接在百度搜索 会有很多的结果,祝你成功
追问
我需求的对百度主页进行POST的方法,应该很简单的代码。我想理解一下NameValuePair[]
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询