傻瓜问题,Microsoft.xmlHTTP怎么post数据?

free_wind 2005-09-25 03:35:02
代码如下:

Set Retrieval = Server.CreateObject("Microsoft.xmlHTTP")
With Retrieval
.Open "GET", url, false, "", ""
.Send
geturl=BytesToString(Retrieval.responseBody)
'GetURL = .ResponseText
End With
Set Retrieval = Nothing
现在,我要提交一个字段:username,值是:test,必须用post,请教一下,怎么改代码?
...全文
691 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
more000 2005-11-14
  • 打赏
  • 举报
回复
<%
Function getHTTPPage(url)
dim objXML
set objXML=server.createobject("MSXML2.XMLHTTP")'定义
objXML.open "GET",url,false'打开
objXML.send()'发送
If objXML.readystate<>4 then '判断文档是否已经解析完,以做客户端接受返回消息
exit function
End If
getHTTPPage=BytesToBstr(objXML.responseBody)'返回信息,同时用函数定义编码
set objXML=nothing'关闭
if err.number<>0 then err.Clear
End Function

Function BytesToBstr(body)
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 = "GB2312"
'转换原来默认的UTF-8编码转换成GB2312编码,否则直接用XMLHTTP调用有中文字符的网页得到的将是乱码
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

Dim Url,Html
Url = "http://www.sina.com.cn"
Html = getHTTPPage(Url)
response.write(Html)
%>
mybaby11 2005-10-18
  • 打赏
  • 举报
回复
在java怎么接收xmlhttp的数据的呢!

var returnStr=oreq.responseText;
fantiny 2005-10-18
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Shift-JIS">
<SCRIPT LANGUAGE="JavaScript">
<!--
function SelText(){
var oRangeRef = document.body.createTextRange();
alert(oRangeRef.text);
}
//-->
</SCRIPT>
<%
function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
'Http.open "GET",url,false
Http.open "POST",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
'getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
getHTTPPage=bytesToBSTR(Http.responseBody,"Shift-JIS")
set http=nothing
if err.number<>0 then
err.Clear
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
%>

<title></title>
</head>

<body onload="SelText()">
<%
Dim Url,Html
'Url="http://localhost/CSharpWebAppTest/WebForm1.aspx?tmp=33333"
'Url="http://localhost/CSharpWebAppTest/WebForm1.aspx"
Url= "http://www.whois.sc/221.216.169.120"
'Url="http://localhost/akira/default.asp"
Html = getHTTPPage(Url)
Response.write Html
%>
</body>
</html>
wubaozhang 2005-10-18
  • 打赏
  • 举报
回复
mark
有ASP的么?
Gdj 2005-10-18
  • 打赏
  • 举报
回复
好象Connection: Keep-Alive的他可以访问
但Connection: Close的页面他就直接出错了。
Gdj 2005-10-18
  • 打赏
  • 举报
回复
xmlhttp很烂的。ie能正常访问的页他访问不了。
xxrl 2005-10-18
  • 打赏
  • 举报
回复
java? 汗!
kill8108 2005-10-06
  • 打赏
  • 举报
回复
在java怎么接收xmlhttp的数据的呢!
lingye 2005-10-05
  • 打赏
  • 举报
回复
<script language="javascript">
stra = "submit1=submit&text1=scsdfsd";
var oreq = new activexobject("msxml2.xmlhttp");
oreq.open("post","tstresult.asp",false);
oreq.setrequestheader("content-length",stra.length);
oreq.setrequestheader("content-type","application/x-www-form-urlencoded");
oreq.send(stra);
</script>

tstresult.asp
--------
request.form("submit1")
request.form("text1")

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧