接口类型:互亿无线触发短信接口,支持发送验证码短信、订单通知短信等。

账户注册:请通过该地址开通账户http://sms.ihuyi.com/register.html

只能测试用:

  实现注册页面

<script type="text/javascript">
function get_mobile_code() {
$.get('Post.aspx', { mobile: jQuery.trim($('#mobile').val()) }, function (msg) {
alert(jQuery.trim(unescape(msg)));
if (msg == '提交成功') {
RemainTime();
}
});
};
var iTime = 59;
var Account;
function RemainTime() {
document.getElementById('zphone').disabled = true;
var iSecond, sSecond = "", sTime = "";
if (iTime >= 0) {
iSecond = parseInt(iTime % 60);
iMinute = parseInt(iTime / 60)
if (iSecond >= 0) {
if (iMinute > 0) {
sSecond = iMinute + "分" + iSecond + "秒";
} else {
sSecond = iSecond + "秒";
}
}
sTime = sSecond;
if (iTime == 0) {
clearTimeout(Account);
sTime = '获取手机验证码';
iTime = 59;
document.getElementById('zphone').disabled = false;
} else {
Account = setTimeout("RemainTime()", 1000);
iTime = iTime - 1;
}
} else {
sTime = '没有倒计时';
}
document.getElementById('zphone').value = sTime;
}
</script>

  

<form action="" method="post" name="formUser" onSubmit="return register();">
<table width="100%" border="0" align="left" cellpadding="5" cellspacing="3">
<tr>
<td align="right">手机<td>
<input id="mobile" name="extend_field5" type="text" size="25" class="inputBg" /><span style="color:#FF0000"> *</span>
<input id="zphone" type="button" value=" 发送手机验证码 " onClick="get_mobile_code();"></td>
</tr>
<tr>
<td align="right">验证码</td>
<td><input type="text" size="8" name="captcha" class="inputBg" /></td>
</tr>
</table>
</form>

后台代码

 public static string PostUrl = ConfigurationManager.AppSettings["WebReference.Service.PostUrl"];
protected void Page_Load(object sender, EventArgs e)
{
string account = "C23795760";//用户名是登录用户中心->验证码、通知短信->帐户及签名设置->APIID
string password = "b79bc3ff3985ea849964fb7a5fdf78ea"; //密码是请登录用户中心->验证码、通知短信->帐户及签名设置->APIKEY
string mobile = Request.QueryString["mobile"];
Random rad = new Random();
int mobile_code = rad.Next(1000, 10000);
string content = "我就是来测试的别害怕zmd:" + mobile_code + " 。请不要把验证码泄露给其他人。"; //Session["mobile"] = mobile;
//Session["mobile_code"] = mobile_code; string postStrTpl = "account={0}&password={1}&mobile={2}&content={3}"; UTF8Encoding encoding = new UTF8Encoding();
byte[] postData = encoding.GetBytes(string.Format(postStrTpl, account, password, mobile, content)); HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(PostUrl);
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = postData.Length; Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(postData, 0, postData.Length);
newStream.Flush();
newStream.Close(); HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
if (myResponse.StatusCode == HttpStatusCode.OK)
{
StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8); //Response.Write(reader.ReadToEnd()); string res = reader.ReadToEnd();
int len1 = res.IndexOf("</code>");
int len2 = res.IndexOf("<code>");
string code = res.Substring((len2 + 6), (len1 - len2 - 6));
//Response.Write(code); int len3 = res.IndexOf("</msg>");
int len4 = res.IndexOf("<msg>");
string msg = res.Substring((len4 + 5), (len3 - len4 - 5));
Response.Write(msg); Response.End(); }
else
{
//访问失败
}
}

web.confg

 <appSettings>
<add key="WebReference.Service.PostUrl" value="http://106.ihuyi.cn/webservice/sms.php?method=Submit"/>
<add key="WebReference.sms" value="http://106.ihuyi.cn/webservice/sms.php?smsService"/>
</appSettings>

.net 实现之短信验证码的更多相关文章

  1. Atitit. 破解  拦截 绕过 网站 手机 短信 验证码  方式 v2 attilax 总结

    Atitit. 破解  拦截 绕过 网站 手机 短信 验证码  方式 v2 attilax 总结 1. 验证码的前世今生11.1. 第一代验证码 图片验证码11.2. 第二代验证码  用户操作 ,比如 ...

  2. jQuery获取短信验证码+倒计时实现

    jQuery 短信验证码倒计时 <script type="text/javascript" charset="utf-8"> $(function ...

  3. 转载:Android自动化测试- 自动获取短信验证码

    前言:android应用的自动化测试必然会涉及到注册登录功能,而许多的注册登录或修改密码功能常常需要输入短信验证码,因此有必要能够自动获得下发的短信验证码. 主要就是实时获取短信信息. android ...

  4. App开发(Android与php接口)之:短信验证码

    最近和同学们一起开发一个自主项目,要用到短信验证码,在网上搜索了很久,看到一个推荐贴,提到了很多不错的短信服务商.经过测试,帖子中提到的服务商他们的短信到达率和到达速度也都不错.最后,由于经费问题,我 ...

  5. android自动获取短信验证码

    前言:android应用的自动化测试必然会涉及到注册登录功能,而许多的注册登录或修改密码功能常常需要输入短信验证码,因此有必要能够自动获得下发的短信验证码.主要就是实时获取短信信息.android上获 ...

  6. Atitit usrQBM1603短信验证码规范

    Atitit usrQBM1603短信验证码规范 短信验证码扩展至短信服务和验证码服务1 主要方法1 参考模板1 短信验证码扩展至短信服务和验证码服务 主要方法 Line 27: public cla ...

  7. atitit 短信验证码的源码实现  .docx

    atitit 短信验证码的源码实现  .docx 参考 Atitit usrQBM1603短信验证码规范1 主要方法1 源码实现1 参考 Atitit usrQBM1603短信验证码规范 主要方法 L ...

  8. Android学习笔记之短信验证码的获取和读取

    PS:最近很多事情都拖拖拉拉的..都什么办事效率啊!!! 还得吐槽一下移动运营商,验证码超过五次的时候,直接把我的手机号封闭.真是受够了. 学习笔记: 1.Android之如何获取短信验证码. 2.如 ...

  9. php实现的IMEI限制的短信验证码发送类

    php实现的IMEI限制的短信验证码发送类 <?php class Api_Sms{ const EXPIRE_SEC = 1800; // 过期时间间隔 const RESEND_SEC = ...

  10. atitit.短信 验证码  破解  v3 p34  识别 绕过 系统方案规划----业务相关方案 手机验证码  .doc

    atitit.短信 验证码  破解  v3 p34  识别 绕过 系统方案规划----业务相关方案 手机验证码  .doc 1. 手机短信验证码 vs 图片验证码 安全性(破解成本)确实要高一些1 1 ...

随机推荐

  1. Thymeleaf 异常:Exception processing template "index": An error happened during template parsing (template: "class path resource [templates/index.html]")

    Spring Boot 项目,在 Spring Tool Suite 4, Version: 4.4.0.RELEASE 运行没有问题,将项目中的静态资源和页面复制到 IDEA 的项目中,除了 IDE ...

  2. Ubuntu开启/var/log/messages

    # 添加配置到/etc/rsyslog.d/50-default.conf cat <<'EOF' | sudo tee -a /etc/rsyslog.d/50-default.conf ...

  3. Java之ConcurrentHashMap源码解析

    ConcurrentHashMap源码解析 目录 ConcurrentHashMap源码解析 jdk8之前的实现原理 jdk8的实现原理 变量解释 初始化 初始化table put操作 hash算法 ...

  4. linux系统上用户态pppoe收发包过程

    花了几天看了一下ppp/pppoe有关的东西,画了一下用户态pppoe收发包的示意图.

  5. 多测师讲解python _函数的传递_高级讲师肖sir

    题目:   要求1.通过函数来实现       2.引用函数传递方法        3.引用返回值   有一个登录系统:账号admin  密码123456 验证码abc123    账号.密码.验证码 ...

  6. python程序整理(1)

    ''' 用户登录验证 要求: 1. 系统⾃动⽣成4位随机数. 作为登录验证码. 直接用就好. 这里不用纠结 提示. 生成随机数的办法. from random import randint num = ...

  7. python 登陆三次错误退出

    登陆出现三次错误,退出程序 1 #登陆 2 def Login(): 3 a = input() 4 if a == 'Kate': 5 b = input() 6 if b == '666666': ...

  8. docker 启动redis/nginx

    1.docker 启动redis   # redis docker run -itd --name redis-test -p 16379:6379 redis   2.docker 启动nginx ...

  9. Baolu CSV Data Set Config

    1.背景 大家在平常使用JMeter测试工具时,对CSV Data Set Config 配置元件肯定不会陌生.如果我们的压测场景涉及到数据库更新操作(如:转账接接口)则需要对参数化数据进行分块,可就 ...

  10. Unity控制角色移动

    Copy代码前的准备工作 整体结构 建立个空对象命名随意,主要是为了:角色掉出地图时,可以回到空对象的位置 在建立个空对象命名为Player,放到PlayResurrectionPoints子级下,并 ...