云片短信平台ASP版程序使用方法:
<%
@LANGUAGE="VBSCRIPT" CODEPAGE="65001"
response.contenttype = "text/html;charset=utf-8"
method = "POST"
mobile = Server.URLEncode("xxxxxxxxxxx") '您要发送的手机号
apikey = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" '修改为您的apikey(https://www.yunpian.com)登录官网后获取
text ="【云片网】您的验证码是1234" '发送内容
url_send_sms = "https://sms.yunpian.com/v2/sms/single_send.json"
data_send_sms = "apikey=" & apikey & "&mobile=" & mobile & "&text=" & text
response.write GetBody(url_send_sms,data_send_sms)
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