以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  怎么开通短信认证  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=117374)

--  作者:mmd888
--  发布时间:2018/4/11 14:55:00
--  怎么开通短信认证
怎么开通短信认证呢?
我准备在阿里云,买一个短信验证码的服务,但是不知道接口怎么写,请老师指导下,谢谢


--  作者:有点甜
--  发布时间:2018/4/11 15:05:00
--  

参考

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=115850&skin=0

 

http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=110175&skin=0

 


--  作者:浙江仔
--  发布时间:2018/4/11 16:09:00
--  

首先引用

aliyun-net-sdk-dysmsapi.dll

aliyun-net-sdk-core.dll



代码:

Dim json As String =args(0)   \'  json代码: "{""name"":"""& name &""",""time"":"""& time &""",""type"":"""& tp &""",""dizhi"":"""& dizhi &""",""beizhu"":"""& beizhu &""",""lxr"":"""& lxr &"""}"


Dim TempCode As String =args(1)  \' "SMS_1297***" 使用模板  

Dim phs As String=args(2)

 

Dim product As String = "Dysmsapi"

Dim domain As String = "dysmsapi.aliyuncs.com"

Dim accessId As String = "你的id"

Dim accessSecret As String ="你的密钥"

Dim regionIdForPop As String = "cn-hangzhou"

 

Dim profile As Aliyun.Acs.Core.Profile.IClientProfile = Aliyun.Acs.Core.Profile.DefaultProfile.GetProfile(regionIdForPop, accessId, accessSecret)

Aliyun.Acs.Core.Profile.DefaultProfile.AddEndpoint(regionIdForPop, regionIdForPop, product, domain) 

Dim acsClient As Aliyun.Acs.Core.IAcsClient = New Aliyun.Acs.Core.DefaultAcsClient(profile)

Dim request As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsRequest = New Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsRequest()

 

Dim phones() As String = phs.Split(",")

For Each phone As String In phones

    Dim r As DataRow=DataTables("SMS_Send_Phone").SQLAddNew()

    r("content")=""

    r("phone")=phone

    r("time")=now

    Try

        request.PhoneNumbers = phone

        request.TemplateCode =TempCode   \';//管理控制台中配置的审核通过的短信模板的模板CODE(状态必须是验证通过)"

        request.SignName = "你的签名"

        request.TemplateParam = json

        request.OutId = Guid.NewGuid().ToString().replace("-","")

        Dim sendSmsResponse As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsResponse = acsClient.GetAcsResponse(request)

        r("BizId")=sendSmsResponse.BizId

        r("tpye")="ALi"

        r("RequestId")=sendSmsResponse.RequestId

        r("Code")=sendSmsResponse.Code

       

        If sendSmsResponse.Message.Tostring="OK" Then

 

        Else

 

        End If

    Catch e As Aliyun.Acs.Core.Exceptions.ServerException

 

    Catch e As Aliyun.Acs.Core.Exceptions.ClientException

 

    End Try

    r.save()

Next

Return ""

[此贴子已经被作者于2018/4/11 16:11:50编辑过]

--  作者:浙江仔
--  发布时间:2018/4/11 16:14:00
--  
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:ali.rar

dll  2.0的

--  作者:zhy400137
--  发布时间:2018/4/11 16:40:00
--  
mark
--  作者:huangfanzi
--  发布时间:2018/4/11 19:07:00
--  
收藏