Foxtable(狐表)用户栏目专家坐堂 → 怎么开通短信认证


  共有2913人关注过本帖树形打印复制链接

主题:怎么开通短信认证

帅哥哟,离线,有人找我吗?
浙江仔
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1326 积分:9603 威望:0 精华:1 注册:2010/7/21 14:20:00
  发帖心情 Post By: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编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
浙江仔
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1326 积分:9603 威望:0 精华:1 注册:2010/7/21 14:20:00
  发帖心情 Post By:2018/4/11 16:14:00 [显示全部帖子]

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:ali.rar

dll  2.0的

 回到顶部