ASP 中使用 HTTP 协议发送参数详解

2018-09-06 11:16

阅读:559

  <%@LANGUAGE=“VBSCRIPT“CODEPAGE=“CP_ACP“%>
<html>
<head>
<metahttp-equiv=“Content-Type“content=“text/html;charset=Shift-JIS“>
<SCRIPTLANGUAGE=“JavaScript“>
<!--
functionSelText(){
varoRangeRef=document.body.createTextRange();
alert(oRangeRef.text);
}
//-->
</SCRIPT>
<%
functiongetHTTPPage(url)
dimHttp
setHttp=server.createobject(“MSXML2.XMLHTTP“)
Http.open“GET“,url,false
Http.open“POST“,url,false
Http.send()
ifHttp.readystate<>4then
exitfunction
endif
getHTTPPage=bytesToBSTR(Http.responseBody,“GB2312“)
getHTTPPage=bytesToBSTR(Http.responseBody,“Shift-JIS“)
sethttp=nothing
iferr.number<>0then
err.Clear
endif
endfunction

FunctionBytesToBstr(body,Cset)
dimobjstream
setobjstream=Server.CreateObject(“adodb.stream“)
objstream.Type=1
objstream.Mode=3
objstream.Open
objstream.Writebody
objstream.Position=0
objstream.Type=2
objstream.Charset=Cset
BytesToBstr=objstream.ReadText
objstream.Close
setobjstream=nothing

EndFunction
%>

<title></title>
</head>

<bodyonload=“SelText()“>
<%
DimUrl,Html
Url=““
Url=““
Url=““
Url=““
Html=getHTTPPage(Url)
Response.writeHtml
%>
</body>
</html>


评论


亲,登录后才可以留言!