patrickl
asked on
MSINET.OCX POST method
I'm trying to post data to a website. The guy who developed the website claimed I could easily post data from an Access application. Well, I tried and it doesn't seem to be working.
I found an example on how to use the MsInet.OCX on:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/xhtml/web/015.asp
It states that you need to use something like:
Dim strURL As String, strFormData As String
strURL = "//www.yippee.com/cgi-bin/find.exe"
strFormData = "find=Hangzhou"
Inet1.Execute strURL, "POST", strFormData
When I try this I get no data posted. I modified the InetSamp database. I was a bit worried when it didn't have a POST example (only a GET example). But the calls for POST and GET are almost identical so I just added the post data and changed "GET" to "POST". That should work according to the example. I just don't get any data posted.
I have had some problems before with the OCX so I searched for an example using the DLL. And there I found the WinInet App written in VB using the DLL. And that one does work. But unfortunately it's quite inreadable code (to me)
I would like to use the simple OCX version of it all. Did someone get this to work? And if so, how ;)
I found an example on how to use the MsInet.OCX on:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/office97/xhtml/web/015.asp
It states that you need to use something like:
Dim strURL As String, strFormData As String
strURL = "//www.yippee.com/cgi-bin/find.exe"
strFormData = "find=Hangzhou"
Inet1.Execute strURL, "POST", strFormData
When I try this I get no data posted. I modified the InetSamp database. I was a bit worried when it didn't have a POST example (only a GET example). But the calls for POST and GET are almost identical so I just added the post data and changed "GET" to "POST". That should work according to the example. I just don't get any data posted.
I have had some problems before with the OCX so I searched for an example using the DLL. And there I found the WinInet App written in VB using the DLL. And that one does work. But unfortunately it's quite inreadable code (to me)
I would like to use the simple OCX version of it all. Did someone get this to work? And if so, how ;)
ASKER
OK, all you (I) need to do is set the form headers.
So a working example would be:
strURL = "//www.yippee.com/cgi-bin/find.exe"
strFormData = "find=Hangzhou"
Inet1.Execute strURL, "POST", strFormData, "Content-Type: application/x-www-form-url encoded"
So a working example would be:
strURL = "//www.yippee.com/cgi-bin/find.exe"
strFormData = "find=Hangzhou"
Inet1.Execute strURL, "POST", strFormData, "Content-Type: application/x-www-form-url
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
OK that's done. By the way, that question would have gotten answered in half an hour or less in the VB section.
http://www.catalyst.com/download/index.html