Home > Archive > ASP > January 2006 > How to send http post request in ASP
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to send http post request in ASP
|
|
| inferno2000@my-deja.com 2006-01-26, 3:55 am |
| Let's say if I want to send a http "Post" request to a url, and check
the http status code later. How should I write the code? I have found
example to use WinHttp to send "Get" request and check the http status
code:
======
Set objWinHttp = CreateObject("WinHttp.WinHttpRequest.5")
objWinHttp.Open "GET", strURL
objWinHttp.Send
If objWinHttp.Status <> 200 Then
...
End If
======
How should I write the code if I need to use "POST" to send data in a
form, and to check the http status code later?
| |
| Marja Ribbers-de Vroed 2006-01-26, 7:55 am |
| <inferno2000@my-deja.com> wrote in message =
news:1138267536.897781.324700@g44g2000cwa.googlegroups.com...
> Let's say if I want to send a http "Post" request to a url, and check
> the http status code later. How should I write the code? I have found
> example to use WinHttp to send "Get" request and check the http status
> code:
>=20
> =3D=3D=3D=3D=3D=3D
> Set objWinHttp =3D CreateObject("WinHttp.WinHttpRequest.5")
> objWinHttp.Open "GET", strURL
> objWinHttp.Send
> If objWinHttp.Status <> 200 Then
> ...
> End If
> =3D=3D=3D=3D=3D=3D
>=20
> How should I write the code if I need to use "POST" to send data in a
> form, and to check the http status code later?
>
Try something like the following:
Set oXmlHttp =3D Server.Createobject("MSXML2.ServerXMLHTTP.4.0")
With oXmlHttp
.open "POST", strURL, False
.send strMessageToSend
If (oXmlHttp.status <> 200) Then
' received some other return status, handle it
...
End If
End With
Set oXmlHttp =3D Nothing
Regards, Marja
| |
| inferno2000@my-deja.com 2006-01-26, 9:55 pm |
|
Marja Ribbers-de Vroed wrote:
> Try something like the following:
>
> Set oXmlHttp = Server.Createobject("MSXML2.ServerXMLHTTP.4.0")
> With oXmlHttp
> .open "POST", strURL, False
> .send strMessageToSend
Thank you, I will try that.
|
|
|
|
|