html5/css教程

javascript教程

asp教程

php教程

jsp教程

C#/.NET教程

Python教程

网络营销

建站经验

点击排行

手机验证码接口代码(asp版)

来源:中文源码网    浏览:528 次    日期:2024-03-28 08:03:47
<%
Sub sendsms(mobile,msg)
	'多个手机号之间用“,”分隔
	dim userid,password,status
	dim xmlObj,httpsendurl
	userid = "test"		'企业ID,请联系我们索取免费测试帐号
	password = "test"	'ID密码,要使用MD5加密为32位密文并转换为小写
	password = LCASE(MD5(password))
	httpsendurl="http://www.smsbao.com/sms?u="&userid&"&p="&password&"&m="&mobile&"&c="&UrlEncode_GBToUtf8_V2(msg)
	status = Rewrite_XMLget(httpsendurl)
	
	response.write msg&"
" response.write status End sub '远程获取函数 Function Rewrite_XMLget(SourceUrl) if SourceUrl="" then Rewrite_XMLget="路径为空" exit function end if dim Get_Obj1 '远程获取 Set Get_Obj1=Server.CreateObject("Microsoft.XMLHTTP") On Error Resume Next Get_Obj1.Open "GET",SourceUrl,False Get_Obj1.send() if Err then set Get_Obj1=nothing Err.Clear Rewrite_XMLget= False set Get_Obj1=nothing exit function End if '转换编码函数 dim Get_Obj2 Set Get_Obj2 = Server.CreateObject("adodb.stream") Get_Obj2.Type = 1 Get_Obj2.Mode =3 Get_Obj2.Open Get_Obj2.Write Get_Obj1.responseBody Get_Obj2.Position = 0 Get_Obj2.Type = 2 '储存数据 Get_Obj2.Charset = "gb2312"'转换函数 Rewrite_XMLget = Get_Obj2.ReadText '关闭组件 Get_Obj2.Close set Get_Obj2 = nothing set Get_Obj1=nothing End Function Private Function UrlEncode_GBToUtf8_V2(szInput) Dim wch, uch, szRet Dim x Dim nAsc, nAsc2, nAsc3 If szInput = "" Then UrlEncode_GBToUtf8_V2= szInput Exit Function End If For x = 1 To Len(szInput) wch = Mid(szInput, x, 1) nAsc = AscW(wch) If nAsc < 0 Then nAsc = nAsc + 65536 If wch = "+" then szRet = szRet & "%2B" ElseIf wch = "%" then szRet = szRet & "%25" ElseIf (nAsc And &HFF80) = 0 Then szRet = szRet & wch Else If (nAsc And &HF000) = 0 Then uch = "%" & Hex(((nAsc \ 2 ^ 6)) Or &HC0) & Hex(nAsc And &H3F Or &H80) szRet = szRet & uch Else uch = "%" & Hex((nAsc \ 2 ^ 12) Or &HE0) & "%" & _ Hex((nAsc \ 2 ^ 6) And &H3F Or &H80) & "%" & _ Hex(nAsc And &H3F Or &H80) szRet = szRet & uch End If End If Next UrlEncode_GBToUtf8_V2= szRet End Function %>

精彩推荐