asp 短信接口 解决产生的乱码问题

记录一下 asp调用短信接口的例子,可以解决80%的调用短信接口产生的乱码问题.

以下代码只是简单的调用,需要根据具体的项目 做相应的修改

<%


Function getHTTPPage(url)
 Dim Http
    Set Http = Server.CreateObject("MSXML2.XMLHTTP")
        Http.Open "GET", url, False
        Http.send()
        If Http.readystate <> 4 Then
            Exit Function
        End If
        getHTTPPage = BytesToBstr(Http.responseBody, "GB2312")
    Set Http = Nothing
    If Err.Number <> 0 Then Err.Clear
End Function

Function BytesToBstr(body, Cset)
 Dim objstream
    Set objstream = Server.CreateObject("adodb.stream")
        objstream.Type = 1
        objstream.Mode = 3
        objstream.Open
        objstream.Write body
        objstream.Position = 0
        objstream.Type = 2
        objstream.Charset = Cset
        BytesToBstr = objstream.ReadText
        objstream.Close
    Set objstream = Nothing
End Function

 

调用短信接口网址官方网站:http://www.56dxw.com
Function SendSms(smsMob,smsText)
'response.Write(smsMob)
'response.End()
   SmsServer="http://jiekou.56dxw.com/sms/HttpInterface.aspx?"  
   userid="60"
   username1="test1"
   userpwd="qwqwqw"
   usersms="1061"
  SenData=SmsServer&"comid="&userid&"&username="&username1&"&userpwd="&userpwd&"&
handtel="&smsMob&"&sendcontent="&smsText&"&sendtime=&smsnumber="&usersmsqwe=getHTTPPage(SenData)
  'response.Write(qwe)

If qwe = "1" then '发送成功
 Response.Write("成功了")
Else '发送失败
 Response.Write("失败了,请联系管理员")
End if

End Function

%>

转载于:https://www.cnblogs.com/jjzydysl/archive/2012/02/20/2360320.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值