81,092
社区成员
发帖
与我相关
我的任务
分享
String result = "";
request.setCharacterEncoding("GBK");
BufferedReader br = request.getReader();
String line = br.readLine();
String[] params = line.split("&");
Map<String,Object> param = new HashMap<String,Object>();
for(String s : params){
String[] keyAndValue = s.split("=");
String key = keyAndValue[0];
String value = keyAndValue[1];
if(key.equals("SMSContent") || key.equals("DestMobile")) {
value = URLDecoder.decode(value,"GBK");
}
param.put(key, value);
if(!isOpen)System.out.println(key+":"+value);
}
if(!isOpen)System.out.println("");
String BizType = param.get("BizType").toString();
if(BizType.equals("01")){
result = smsWordService.senMsgServiceAPI(param);
}else if(BizType.equals("02")){
System.out.println("已发短信查询");
}else if(BizType.equals("03")){
System.out.println("上行短信查询");
}
strb.append("http://127.0.0.1:8080/PoliceProtectionSystem/sms?BizType=01&LoginName=stjbpt&Password=st7023");
//strb.append("http://10.32.10.190/sms/SMSOutServlet?BizType=01&LoginName=stjbpt&Password=st7023");
strb.append("&DestMobile=").append(mobile);
strb.append("&SMSContent=").append(content);
try {
httpconn = (HttpURLConnection) new URL(strb.toString()).openConnection();
httpconn.setConnectTimeout(60000);
httpconn.setDoOutput(true);
httpconn.setRequestMethod("POST");
httpconn.setUseCaches(false);
httpconn.setInstanceFollowRedirects(true);
httpconn.setRequestProperty("Content-Type", "multipart/form-data");
httpconn.connect();
ByteArrayOutputStream bout = new ByteArrayOutputStream();
out = new DataOutputStream(httpconn.getOutputStream());
out.write(bout.toByteArray());
InputStream in = new BufferedInputStream(httpconn.getInputStream());
rd = new InputStreamReader(in,"UTF-8");
int c = 0;
StringBuilder sb = new StringBuilder();
while ((c = rd.read()) != -1) {
sb.append((char) c);
}
in.close();
strHtml = sb.toString();