让用户发特定短信到一个号码,来验证用户当前的手机号。
不知有这样的短信平台么?
聚合数据。
推荐 SUBMAIL ,API健壮性、稳定性都得到很多业内大牛的认可,欢迎试用 http://submail.cn
推荐使用submail短信服务,支持上行短信,申请固定签名,还可以发送营销类短信。
创蓝短信验证码http://cl2009.com可以支持上行和下行短信验证,他们的速度挺快,有一个产品是5秒到;一客一签,10690端口,是专属端口,全国唯一,速度和到达率都很有保障。可在官网查阅并咨询详情。
你说的是支持客户上行是吗?现在是个短信平台就支持啊。可以去阅信短信验证码平台看下,我这边有他们的HTTP接口。
http接口,别的接口还是亲自联系他们的人吧。不错的。
短信发送
//接口地址
String url = "http://183.203.28.5:9000/HttpSmsMt";
//下发时间
String mttime = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
Map<String, String> param = new HashMap<String, String>();
param.put("name", "用户帐号");
param.put("pwd", Tools.MD5("用户密码"+mttime));
param.put("content", URLEncoder.encode("【金楼世纪】验证码888888,打死也不能告诉别人哦。", "UTF-8"));
param.put("phone", "13400000000");
param.put("subid", "");
param.put("mttime", mttime);
HttpTool.sendPost(url, param);
POST提交方法
public static String sendPost(String url, Map<String, String> params) {
Log.i("POST提交:[url="+url+"]"+params.toString());
URL u = null;
HttpURLConnection con = null;
// 构建请求参数
StringBuffer sb = new StringBuffer();
if (params != null) {
for (Entry<String, String> e : params.entrySet()) {
sb.append(e.getKey()).append("=").append(e.getValue()).append("&");
}
sb.substring(0, sb.length() - 1);
}
// 尝试发送请求
try {
u = new URL(url);
con = (HttpURLConnection) u.openConnection();
con.setRequestMethod("POST");
con.setConnectTimeout(6000);
con.setDoOutput(true);
con.setDoInput(true);
con.setUseCaches(false);
con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
OutputStreamWriter osw = new OutputStreamWriter(con.getOutputStream(), "UTF-8");
osw.write(sb.toString());
osw.flush();
osw.close();
} catch (Exception e) {
Log.e(e);
} finally {
if (con != null) {
con.disconnect();
}
}
// 读取返回内容
StringBuffer buffer = new StringBuffer();
try {
BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
String temp;
while ((temp = br.readLine()) != null) {
buffer.append(temp).append("\n");
}
} catch (Exception e) {
Log.e(e);
}
Log.i("POST响应:"+buffer.toString());
return buffer.toString();
}
MD5加密方法
public static String MD5(String str){
MessageDigest md5 = null;
try{
md5 = MessageDigest.getInstance("MD5");
}catch (Exception e){
Log.i(e.getMessage());
return "";
}
char[] charArray = str.toCharArray();
byte[] byteArray = new byte[charArray.length];
for (int i = 0; i < charArray.length; i++)
byteArray[i] = (byte) charArray[i];
byte[] md5Bytes = md5.digest(byteArray);
StringBuffer hexValue = new StringBuffer();
for (int i = 0; i < md5Bytes.length; i++){
int val = ((int) md5Bytes[i]) & 0xff;
if (val < 16){
hexValue.append("0");
}
hexValue.append(Integer.toHexString(val));
}
return hexValue.toString();
}
秒嘀短信验证码支持上行短信验证,到达及时有保证,可以去试用一下 http://www.miaodiyun.com
可以试下叮咚云短信平台奥
推荐一个 短信宝 支持接收短信,不过我没尝试过,发短信的挺好用的。
(在V站上看到人推荐野路子用的。)
如果有其他更好了,欢迎推荐。
(用云通讯那个被坑惨了,充了钱才发现只支持发送验证码类型的短信,而且各种审批,麻烦的一比,不适合野路子小项目。)
有的,https://luosimao.com 支持上行回复推送