public static JSONObject wxdoPost(String url, JSONObject jsonData) {// 指定Post请求HttpPost httpPost = new HttpPost(url);// 创建httpclientHttpClient httpClient = new DefaultHttpClient();// 发送请求org.apache.http.HttpResponse httpResponse;// 返回的jsonJSONObject jsonObject = null;// 封装post请求数据StringEntity entity = new StringEntity(jsonData.toString(), "utf-8");httpPost.setEntity(entity);try {// 发送请求httpResponse = httpClient.execute(httpPost);// 判断请求是否成功if(httpResponse.getStatusLine().getStatusCode()==HttpStatus.SC_OK){// 得到请求响应信息String str = EntityUtils.toString(httpResponse.getEntity(), "utf-8");// 返回jsonjsonObject=JSONObject.fromObject(str);}} catch (ClientProtocolException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}return jsonObject;
}
详细解决方案
微信API调用post
热度:50 发布时间:2024-02-02 07:40:23.0
相关解决方案
- $.post()+struts2解决方法
- 关于Servlet容器和doGet/Post()的疑问,该如何处理
- 求解$.post(url,{},function(){});回调函数中怎么使用判断语句
- 关于Servlet器皿和doGet/Post()的疑问
- ajax Post 一直返回的是error ,为啥
- $.post 不走回调函数,求高手
- form表单method=“post”交付为什么路径action还出现在地址栏中
- $.post params 传值有关问题 大神们看看
- jquery-1.4.2.min.js $.post()不好用解决方法
- post 提交比get提交的安全性有关问题
- post 编码转换有关问题
- MVC jQuery Post 提交有关问题
- POST 汉字,获取值不是汉字,如何转换回来呀
- HttpWebRequest post json 数据,接受应该怎么获取啊
- 毕竟什么时候用method=post
- 帮忙看一上初学者有关问题~jquery.post()
- jquery ajax $post 为什么调用不到后台方法,该怎么处理
- 安全扫描处理 发送敏感信息时,始终使用 SSL 和 POST(主体)参数,该怎么处理
- ajax post 页面返回值有关问题
- 上传文件过大出现次异常,"Event message: Post 大小超出允许的限制。" ,怎么解决
- [ajax小疑点]关于xmlHttp.open("POST" url, true),详细如下
- ajax有关问题 在xmlhttp.open("post"url,true)中,url为一个xml文件在服务器端的,并且xmlhttp.send(null),在响应函数里处理这个按理正常返
- ◆◇◆ 关于 htm 页面向 aspx 页面 post 的有关问题! ◆◇◆
- HTTP method POST is not supported by this URL
- post http 405
- post 与get的区别
- post 给asp页面的json数据,asp里面如何获取啊
- 表单有20项,post,get选用那个?该如何处理
- post textarea图文信息到靠山,但是后台无法提取到图片数组,求解?
- 郁闷 <form name="form1" method="post" action="savemessage.asp" >提交不到下一个页,该如何处理