欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2023-11-13 15:11:16
<%@language=“vbscript“ codepage=“cp_acp“%>     
<%@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>