views:

92

answers:

3

How can I http post data to any page in the web in Classic ASP?

+1  A: 

Please see:

System.Net.HttpWebRequest in classic asp?

Mitch Wheat
+1  A: 

Try this:

Set xmlhttp = Server.CreateObject("Microsoft.ServerXMLHTTP")
xmlhttp.Open "POST", "http://yoursite", false
xmlhttp.Send data

Response.Write xmlhttp.ResponseText
Rubens Farias
Don't use XMLHTTP in ASP, use ServerXMLHTTP as @Jakkwylde indicates.
AnthonyWJones
fixed, ty Anthony
Rubens Farias
+2  A: 

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
Jakkwylde