post
<%
Dim aa
aa=GetHttpPage("http://localhost/test1.asp?userid=1")
Response.Write(aa)
Function GetHttpPage(HttpUrl)
If IsNull(HttpUrl) = True Or Len(HttpUrl)<18 Or HttpUrl = "$False$" Then
GetHttpPage = "$False$"
Exit Function
End If
Dim Http
Set Http = server.CreateObject("MSXML2.XMLHTTP")
Http.Open "Post", HttpUrl, False
Http.setRequestHeader "CONTENT-TYPE", "application/x-www-form-urlencoded"
Http.Send("str=可是我实验了,都不成功,请问,应该怎样修改")
If Http.Readystate<>4 Then
Set Http = Nothing
GetHttpPage = "$False$"
Exit Function
End If
GetHTTPPage = bytesToBSTR(Http.responseBody, "utf-8")
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
%>
get
<%
Private Function bytes2BSTR(vIn)
Dim i, ThischrCode, NextchrCode
strReturn = ""
For i = 1 To LenB(vIn)
ThischrCode = AscB(MidB(vIn, i, 1))
If ThischrCode < &H80 Then
strReturn = strReturn & Chr(ThischrCode)
Else
NextchrCode = AscB(MidB(vIn, i + 1, 1))
strReturn = strReturn & Chr(CLng(ThischrCode) * &H100 + CInt(NextchrCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> -- </TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<BODY>
<%
Dim aa
aa=GetURL("http://localhost/test1.asp?userid=1","userid=2")
Response.Write(aa)
Function GetURL(url,posts)
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
On Error Resume Next
.Open "post",url, False,"", ""
.Send posts
GetURL = .ResponseText
GetURL = bytes2BSTR(.Responsebody)
End With
if Retrieval.Status<>200 then
Set Retrieval = Nothing
Exit Function
end If
End Function
%>
</BODY>
</HTML>