HttpClient client = new HttpClient();
PostMethod post=null;
String info="";
try {
post = new PostMethod("http://192.168.11.178/SMSCore/sendSMS.do");
NameValuePair[] postdata = new NameValuePair[4];
postdata[0] = new NameValuePair("telephone",this.receivers );
postdata[1] = new NameValuePair("message",this.content );
postdata[2] = new NameValuePair("system","console" );
postdata[3] = new NameValuePair("sysPassword","123");
post.addRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");//关键代码
post.addParameters(postdata);
int state = client.executeMethod(post);
String html=post.getResponseBodyAsString();
setAjax_out_data(new ByteArrayInputStream(html.getBytes("UTF-8")));
} catch (Exception e) {
e.printStackTrace();
}finally{
post.releaseConnection();
}
HTTPClient PostMethod 中文乱码处理
最新推荐文章于 2022-09-14 11:37:36 发布