用第三方短信提供商
我们项目用的是:http://www.smschinese.cn/api.shtml
我们项目用的是:http://www.smschinese.cn/api.shtml
解决方案 »
- spring是如何对事务进行管理的
- ireport莫名出现空白~~求指教~~急
- web.xml和struts-config.xml里配置applicationContext.xml的区别
- 高分买模拟confirm效果代码
- 一个简单得radio问题
- 没用过JBuilder8,如何将PSO.jar、JBuilder目录下的Axis、JUnit类库引用到工程中?
- 有哪位试过在weblogig6。1下访问oracle9i?我这里会报如下错误:java.sql.SQLException: ORA-00600: 内部错误代码,参数: [ttcgcshnd-1],
- jsp里怎么把图片文件上传到oracle数据库里?
- 一个简单问题,作多层的循环的时候……
- session调用错误
- 请教大家一个关于cas单点登录流程的一个问题
- 速卖通 AliExpress 上传发布产品接口调用(List参数处理?)
import="java.sql.*" import="java.net.*" import="java.io.*" errorPage=""%>
<%@page import="java.io.DataInputStream"%>
<%@ page import='com.xianxia.been.MD5'%><%
//用户ID和KEY
String UserId = "";
String key = ""; String phone = request.getParameter("Tel"); MD5 md5 = new MD5();
String pwdmd5 = md5.getMD5ofStr(UserId + "0" + phone + key); String curlPost = "UserId=" + URLEncoder.encode(UserId, "UTF-8")
+ "&phone=" + URLEncoder.encode(phone, "UTF-8")
+ "&Md5Str=" + URLEncoder.encode(pwdmd5, "UTF-8"); URL url = null;
HttpURLConnection httpurlconnection = null;
try {
url = new URL("http://106.ihuyi.com/webservice/sms.php?");
//url = new URL("http://127.0.0.1:81/webcode/outcallInterface.php");
httpurlconnection = (HttpURLConnection) url.openConnection();
httpurlconnection.setDoOutput(true);
httpurlconnection.setRequestMethod("POST");
httpurlconnection.setRequestProperty("Connection", "Keep-Alive");
httpurlconnection.setRequestProperty("Content-Type ",
"application/x-www-form-urlencoded ");
httpurlconnection.getOutputStream().write(
curlPost.getBytes("UTF-8"));
httpurlconnection.getOutputStream().flush();
httpurlconnection.getOutputStream().close(); DataInputStream is = new DataInputStream(httpurlconnection
.getInputStream());
BufferedReader reader = new BufferedReader(
new InputStreamReader(is));
StringBuilder sb = new StringBuilder(); String line = null; try {
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) { } finally {
try {
is.close();
} catch (IOException e) { }
} String authcode = sb.toString();
// out.print(authcode);
if (authcode.length() > 1) {
session.setAttribute("code", authcode); out.print("ok"); return;
} else {
out.print("error");
return;
}
} catch (Exception e) {
//e.printStackTrace();
} finally {
if (httpurlconnection != null) {
httpurlconnection.disconnect();
}
}
%>
这样可以吗