代码示例

代码下载asp代码示例  在线技术支持

					 
	<%
	Function BytesToBstr(body,code) 
	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 =code
	BytesToBstr = objstream.ReadText 
	objstream.Close 
	set objstream = nothing 
	End Function
	%>

	<%
	'response.ContentType="text/xml;charset=UTF-8'
	%>
	
<% Function UrlEncoding(DataStr) Dim StrReturn,Si,ThisChr,InnerCode,Hight8,Low8 StrReturn = "" For Si = 1 To Len(DataStr) ThisChr = Mid(DataStr,Si,1) If Abs(Asc(ThisChr)) < &HFF Then StrReturn = StrReturn & ThisChr Else InnerCode = Asc(ThisChr) If InnerCode < 0 Then InnerCode = InnerCode + &H10000 End If Hight8 = (InnerCode And &HFF00)\ &HFF Low8 = InnerCode And &HFF StrReturn = StrReturn & "%" & Hex(Hight8) & "%" & Hex(Low8) End If Next UrlEncoding = StrReturn End Function Function GetSeed() timeStr=now() GetSeed=cstr(Year(timeStr))+cstr(Month(timeStr)) +cstr(Day(timeStr))+cstr(hour(timeStr))+cstr(Minute(timeStr))+cstr(Second(timeStr)) End Function %> <% '发送短信' 'accName 用户名' 'accPwd 密码' 'aimcodes 电话' 'content 内容' 'seed 当前时间 格式:YYYYMMDD HHMISS 例如:20130806102030' 'sign 签名' %> <% accName="用户名" accPwd="密码" sign="签名" Function SendSms(mobiles,content) seed=GetSeed() password=UCase(md5(UCase(md5(accPwd)+seed))) url="accName="+accName+"&accPwd="+password+"&aimcodes="+mobiles+"&content="+content+sign+"&seed="+seed Set HttpReq = Server.CreateObject("Microsoft.XMLHTTP") HttpReq.open "post", "//sdk.lx198.com/sdk/send2", False,"","" HttpReq.setRequestHeader "Content-Length",len(url) HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" url=URLEncoding(url) HttpReq.send(url) str=HttpReq.responseText response.Write str End Function <% '查询回执报告' 'accName 用户名' 'accPwd 密码' 'seed 当前时间 格式:YYYYMMDD HHMISS 例如:20130806102030' %> Function qryReport() seed=GetSeed() password=UCase(md5(UCase(md5(accPwd)+seed))) url="accName="+accName+"&accPwd="+password+"&seed="+seed Set HttpReq = Server.CreateObject("Microsoft.XMLHTTP") HttpReq.open "post", "//sdk.lx198.com/sdk/qryReport2", False,"","" HttpReq.setRequestHeader "Content-Length",len(url) HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" url=URLEncoding(url) HttpReq.send(url) str=HttpReq.responseText response.Write str End Function <% '查询余额' 'accName 用户名' 'accPwd 密码' 'seed 当前时间 格式:YYYYMMDD HHMISS 例如:20130806102030' %> Function qryBalance() seed=GetSeed() password=UCase(md5(UCase(md5(accPwd)+seed))) url="accName="+accName+"&accPwd="+password+"&seed="+seed Set HttpReq = Server.CreateObject("Microsoft.XMLHTTP") HttpReq.open "post", "//sdk.lx198.com/sdk/qryBalance2", False,"","" HttpReq.setRequestHeader "Content-Length",len(url) HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" url=URLEncoding(url) HttpReq.send(url) str=HttpReq.responseText response.Write str End Function <% '查询上行短信' 'accName 用户名' 'accPwd 密码' 'seed 当前时间 格式:YYYYMMDD HHMISS 例如:20130806102030' %> Function receiveSms() seed=GetSeed() password=UCase(md5(UCase(md5(accPwd)+seed))) url="accName="+accName+"&accPwd="+password Set HttpReq = Server.CreateObject("Microsoft.XMLHTTP") HttpReq.open "post", "//sdk.lx198.com/sdk/receiveSms2", False,"","" HttpReq.setRequestHeader "Content-Length",len(url) HttpReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset=UTF-8" url=URLEncoding(url) HttpReq.send(url) str=HttpReq.responseText response.Write str End Function SendSms "电话号","测试内容" qryReport qryBalance receiveSms %>