落伍者站长论坛's Archiver

承诺 发表于 2008-4-17 12:25

Http.Open "GET"返回的数据如何重新定义?

这么一段代码[code]
<!--#include file="inc_connect.asp"-->
<%
'防止外部提交数据
Response.Buffer = True   
Response.ExpiresAbsolute = Now() - 1   
Response.Expires = 0   
Response.CacheControl = "no-cache"
Function IsSelfRefer()   
Dim sHttp_Referer, sServer_Name
sHttp_Referer = CStr(Request.ServerVariables("HTTP_REFERER"))
sServer_Name = CStr(Request.ServerVariables("SERVER_NAME"))
If Mid(sHttp_Referer, 8, Len(sServer_Name)) = sServer_Name Then
IsSelfRefer = True
Else
IsSelfRefer = False
End If
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

set rs= server.createobject("adodb.recordset")
sql="select top 1 * from [admin]"
rs.open sql,conn,3,2
strUser=rs("smsuser")
strPwd=rs("smspassword")
set http = Server.CreateObject("Microsoft.XMLHTTP")
Http.Open "GET", "http://www.***.cn/cgi/querycount.asp?User="&struser&"&Pass="&strPwd&"",false
Http.Send
result=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn">
<head>
<meta http-equiv="content-language" content="zh-cn" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>##余额查询</title>
<link rel="stylesheet" type="text/css" href="skins/default/style.css" />
<script type="text/javascript" src="inc_common.js"></script>
<SCRIPT   LANGUAGE="JavaScript">   
  document.onkeydown   =   function()   {   
  if(event.keyCode==116)   {   
  event.keyCode=0;   
  event.returnValue   =   false;   
  }   
  }   
  document.oncontextmenu   =   function()   {event.returnValue   =   false;}   
  </SCRIPT>
</head>

        <div id="smallWrapper" style="padding: 12px 6px;">
<span class="smsNO">NO.#<%=strUser%></span><hr>
        
<fieldset>
<legend>余额查询</legend>
<div><span class="smstitle"><%=result%>
</span></div>
</fieldset>

</div>
</body>
</html>
<%
Call check_path()
%>
[/code]result=bytesToBSTR(Http.responseBody,"GB2312")
返回的结果格式为[code]100 Report?Count=1000&Send=8300&Left=2700[/code]如何让他显示比如
统计=1000
发送=8300
剩余=2700

[[i] 本帖最后由 承诺 于 2008-4-19 18:22 编辑 [/i]]

英雄城 发表于 2008-4-17 19:37

统计=<%=request("Count")%>

承诺 发表于 2008-4-19 18:22

再定

承诺 发表于 2008-4-20 18:01

没人回答?

smnh 发表于 2008-4-20 18:12

[code]

<fieldset>
<legend>余额查询</legend>
<div><span class="smstitle"><%

result=replace(result,"100 Report?","")
result=replace(result,"&","<br>")
result=replace(result,"Count","统计")
result=replace(result,"Send","发送")
result=replace(result,"Left","剩余")


response.write result
%>
</span></div>
</fieldset>



[/code]

承诺 发表于 2008-4-23 15:47

非常感谢楼上的

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.