asp DEMO
功能說(shuō)明:該接口要求提前在云片后臺(tái)添加模板,提交短信時(shí),系統(tǒng)會(huì)自動(dòng)匹配審核通過(guò)的模板,匹配成功任意一個(gè)模板即可發(fā)送。系統(tǒng)已提供的默認(rèn)模板添加簽名后可以直接使用。
<% '安裝IIS并重啟后可用 @LANGUAGE="VBSCRIPT" CODEPAGE="65001" %> <% response.contenttype = "text/html;charset=utf-8" '提交方法 method = "POST" '您要發(fā)送的手機(jī)號(hào) mobile = Server.URLEncode("xxxxxxxxxxx") '修改為您的apikey(http://www.ssjdyy2.com)登錄官網(wǎng)后獲取 apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" '發(fā)送內(nèi)容 text ="【云片網(wǎng)】您的驗(yàn)證碼是1234,5分鐘內(nèi)有效。" '使用模板號(hào) tpl_id = 365741 '使用模板內(nèi)容 tpl_value = Server.URLEncode("#code#=1234&#min#=5") '查詢(xún)賬戶(hù)信息https地址 url_get_user = "https://sms.yunpian.com/v2/user/get.json" '智能匹配模板發(fā)送https地址 url_send_sms = "https://sms.yunpian.com/v2/sms/single_send.json" '指定模板發(fā)送接口https地址 url_tpl_sms = "https://sms.yunpian.com/v2/sms/tpl_single_send.json" '發(fā)送語(yǔ)音驗(yàn)證碼接口https地址 url_send_voice = "https://voice.yunpian.com/v2/voice/send.json" data_get_user = "apikey=" & apikey data_send_sms = "apikey=" & apikey & "&mobile=" & mobile & "&text=" & text data_tpl_sms = "apikey=" & apikey & "&mobile=" & mobile & "&tpl_id=" & tpl_id &_ "&tpl_value=" & tpl_value data_send_voice = "apikey=" & apikey & "&mobile=" & mobile & "&code=" & "1234" response.write GetBody(url_get_user,data_get_user) response.write GetBody(url_send_sms,data_send_sms) response.write GetBody(url_tpl_sms,data_tpl_sms) response.write GetBody(url_send_voice,data_send_voice) Function GetBody(url,data) Set https = Server.CreateObject("MSXML2.ServerXMLHTTP") With https .Open method, url, False .setRequestHeader "Content-Type","application/x-www-form-urlencoded" .Send data GetBody= .ResponseBody End With GetBody = bytetostr(https.ResponseBody,"utf-8") Set https = Nothing End Function function bytetostr(vin,cset) dim bs,sr set bs = server.createObject("adodb.stream") bs.type = 2 bs.open bs.writetext vin bs.position = 0 bs.charset = cset bs.position = 2 sr = bs.readtext bs.close set bs = nothing bytetostr = sr end function %>