Reputation: 8704
In my MS Access application I need to send a batch of info to my webserver on a regular basis. I don't need anything fancy like SOAP, XML-RPC or anything, just a simple POST page request is sufficient. I've Googled a bit but have been unable to turn up anything really helpful.
Does anyone know of a resource or have a code sample to perform this?
Upvotes: 2
Views: 2571
Reputation: 97131
Here is one I used for HTTP GET requests where I wanted to retrieve a web page's HTML. You could substitute POST for the pMethod parameter and discard the response text.
I used MSXML2 which is not guaranteed to be available across all Windows versions. If it's not available on your systems, you could try MSXML instead. Or use an error handler to fall back to MSXML when MSXML2 not available.
Public Function HttpRequest(ByVal pUrl As String, _
Optional ByVal pMethod As String = "GET") As String
Dim strResponse As String
Dim objHttp As Object
'use "MSXML.XMLHTTPRequest" if MSXML2 not available '
Set objHttp = CreateObject("MSXML2.XMLHTTP")
objHttp.Open pMethod, pUrl, False
objHttp.send
strResponse = objHttp.responseText
HttpRequest = strResponse
Set objHttp = Nothing
End Function
Upvotes: 2