多条告白如次剧本只需引入一次
简介
狐表扶助文书档案里的用httpClient挪用阿里云接口的案例(http://www.foxtable.com/mobilehelp/index.htm?page=0246.htm ),是阿里云的第三方平台商场购置的。长处即是采用多,摆设大略,然而即使您是想发送淘宝经营销售实行短信,您是没方法经过短信存案的。基础都说您是经营销售短信,不承诺存案。
以是我就只能用阿里云官方的短信接口。乒坛里也有好几个如许的代码案例,然而都不全,要本人推敲窜改,我这边整治完备能用的。
1增添dll援用
dll载入链接:https://pan.baidu.com/s/1dbUc7T-XbJGHyNZF2b9gYQ索取码:rbhn
援用阿里云短信供给的net2.0本子的dll接口文献
2阿里备案好 出面+动静沙盘
去阿里云的官网,备案账号,开明短信模块,获得短信出面和短信沙盘称呼。这个自行探求,我不教你,这个不难的。即使连这个你都探求不会,你别接洽短信接口了。
3发送代码如次
Dim product As String = "Dysmsapi" '无需变动,官方称呼Dim domain As String = "dysmsapi.aliyuncs.com" '无需变动,官方称呼Dim accessId As String = "xxx" '调换为您的AccessKeyDim accessSecret As String = "xxx" '调换为您的AccessSecretDim 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 response As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsResponse = NothingTry request.PhoneNumbers = "13827126079" request.SignName = "迈宝伦高科技" '调换为您存案的短信出面 request.TemplateCode = "SNS_1234343245" '调换您存案的短信沙盘 request.TemplateParam = "{""customer"":""123""}" '即使您有可替代的标签,不妨树立树立json,也不妨解释掉 'request.OutId = "YourID" '这玩意姑且没用 response = acsClient.GetAcsResponse(request) MessageBox.show(response.Message) '这边输入发送截止."OK"即是行了.Catch ex As Exception MessageBox.show("短信代码有题目,请接洽本领员")End TryCOPY4第三方短信
即使你真的不过发考证码类短信,不是发告白短信,那你用底下的本领https://market.aliyun.com/products/56928004/cmapi027240.html?spm=5176.730005.productlist.d_cmapi027240.xy5oIm#sku=yuncode2124000000
参考扶助文书档案:http://www.foxtable.com/mobilehelp/index.htm?page=0246.htm
只须要买了此后,改掉AppCode就搞定了,超等大略啊
Dim hc As New HttpClient("http://feginesms.market.alicloudapi.com/codeNotice?param=123456&phone=17703940712&sign=1&skin=1")hc.Headers.Add("Authorization","APPCODE " & "xxx请改本人xxx")Dim jo As JObject = Jobject.Parse(hc.GetData)Output.Show(jo.ToString)