Basically I want to retrieve the HTML output a CGI produces when a user
enters some value into the search field of a form that uses POST.
I know the basics of POST and x-www-form-urlencoded and all that, and I
have a working VBA code snippet (used WinInet.dll) to perform an HTTP
GET but I'd like something I'd just have to copy/paste into my Word
macro, instead of having to write it from scratch...
TIA
In article <39D9DDDC...@ocegr.fr>,
Sent via Deja.com http://www.deja.com/
Before you buy.
Maybe just 'cos I'm lazy ;-)
Actually I was unsure I would be able to play the stdout/stdin game that
POST requires with WinInet from VBA (probably using InternetWriteFile
would have done it)
> basics first. Here is my sample: www.schmidks.de > My Tools > "Http
> Post ...". It uses the XMLHttp object rather than WinInet.dll.
Seems to yield far simpler code. Hope this can work from Word 97's VBA
-- I'm not using real VB, as you are.
Thx for the code.
Regards,
Stephane.
As I expected, the VB->VBA translation is not without pain. I'm
currently with:
Sub HTTPPost()
Dim strText As String
Dim strBody As String
Dim strFileName As String
Dim oHttp As Object
' XMLHTTP26 fails, this works (version? I have IE5.5 installed
Set oHttp = CreateObject("Microsoft.XMLHTTP")
oHttp.Open "POST", "http://userwebs.ocegr.fr/~sba/cgi-bin/post-query",
False
oHttp.setRequestHeader "Content-Type",
"application/x-www-form-urlencoded"
strBody = "INITIAL=on&PATTERN=sba&SITE=0&x=28&y=12"
'the send method fails consistenly with error 0x80004005
oHttp.send strBody
Debug.Print oHttp.responseText
End Sub
Any clue?
TIA