How can I http post data to any page in the web in Classic ASP?
How can I http post data to any page in the web in 开发者_如何转开发Classic ASP?
I'd suggest ServerXMLHTTP
over XmlHttp
for the reasons below:
XMLHTTP is designed for client applications and relies on URLMon, which is built upon Microsoft Win32 Internet (WinInet). ServerXMLHTTP is designed for server applications and relies on a new HTTP client stack, WinHTTP. ServerXMLHTTP offers reliability and security and is server-safe.
http://support.microsoft.com/kb/290761
Example:
DataToSend = "id=1"
dim xmlhttp
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://localhost/Receiver.asp",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend
Set xmlhttp = nothing
Please see:
System.Net.HttpWebRequest in classic asp?
Try this:
Set xmlhttp = Server.CreateObject("Microsoft.ServerXMLHTTP")
xmlhttp.Open "POST", "http://yoursite", false
xmlhttp.Send data
Response.Write xmlhttp.ResponseText
If you're trying to redirect a POST request, you can use Server.Transfer
精彩评论