|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<% Sub sendsms(mobile,msg)'多个手机号之间用“,”分隔dim userid,password,statusdim xmlObj,httpsendurluserid = "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 statusEnd sub'远程获取函数Function Rewrite_XMLget(SourceUrl)if SourceUrl="" thenRewrite_XMLget="路径为空"exit functionend ifdim Get_Obj1'远程获取Set Get_Obj1=Server.CreateObject("Microsoft.XMLHTTP")On Error Resume NextGet_Obj1.Open "GET",SourceUrl,FalseGet_Obj1.send()if Err thenset Get_Obj1=nothingErr.ClearRewrite_XMLget= Falseset Get_Obj1=nothingexit functionEnd if'转换编码函数dim Get_Obj2Set Get_Obj2 = Server.CreateObject("adodb.stream")Get_Obj2.Type = 1Get_Obj2.Mode =3Get_Obj2.Open Get_Obj2.Write Get_Obj1.responseBodyGet_Obj2.Position = 0Get_Obj2.Type = 2'储存数据Get_Obj2.Charset = "gb2312"'//转换函数Rewrite_XMLget = Get_Obj2.ReadText '关闭组件Get_Obj2.Closeset Get_Obj2 = nothingset Get_Obj1=nothingEnd FunctionPrivate Function UrlEncode_GBToUtf8_V2(szInput)Dim wch, uch, szRetDim xDim nAsc, nAsc2, nAsc3If szInput = "" ThenUrlEncode_GBToUtf8_V2= szInputExit FunctionEnd IfFor x = 1 To Len(szInput)wch = Mid(szInput, x, 1)nAsc = AscW(wch)If nAsc < 0 ThennAsc = nAsc + 65536If wch = "+" thenszRet = szRet & "%2B"ElseIf wch = "%" thenszRet = szRet & "%25"ElseIf (nAsc And &HFF80) = 0 ThenszRet = szRet & wchElse If (nAsc And &HF000) = 0Then uch = "%" & Hex(((nAsc \ 2 ^ 6)) Or &HC0) & Hex(nAsc And &H3F Or &H80)szRet = szRet & uchElse uch = "%" & Hex((nAsc \ 2 ^ 12) Or &HE0) & "%" & _ Hex((nAsc \ 2 ^ 6) And &H3F Or &H80) & "%" & _ Hex(nAsc And &H3F Or &H80)szRet = szRet & uchEnd IfEnd IfNextUrlEncode_GBToUtf8_V2= szRet End Function%> |