I'm moving away from using Microsoft.XMLHTTP to Chilkat.http
The way we use to use the POST before was:
Function HTTPPost(sUrl,sRequest) set oHTTP = CreateObject("Microsoft.XMLHTTP") oHTTP.open "POST", sUrl,false oHTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" oHTTP.setRequestHeader "Content-Length", Len(sRequest) oHTTP.send sRequest HTTPPostT = oHTTP.responseText Set oHTTP = Nothing End FunctionAll the parameters that we had to send were inside sRequest. With Chilkat post example I've seen I have to parse the parameters and add them each individually using AddParam.
Also the domain has to be sent seperately like so: Set resp = http.SynchronousRequest(domain,port,ssl,req)
Which I would have to parse as well.
I guess my question is:
Is there a way to pass these paramters the same way as I was doing before & still use post instead of get.
Using Chilkat, it would look like this:
set http = Server.CreateObject("Chilkat.Http")
' Any string unlocks the component for the 1st 30-days. success = http.UnlockComponent("Anything for 30-day trial") If (success <> 1) Then HTTPPostT = "Failed" Exit Function End If
set req = Server.CreateObject("Chilkat.HttpRequest")
' Add the request params expected by the server-side: req.LoadBodyFromString sRequest, "ansi"
' No need to set Content-Length or Content-Type ' resp is a Chilkat.HttpResponse Set resp = http.PostUrlEncoded(sUrl,req) If (resp Is Nothing ) Then HTTPPostT = "Failed" Else HTTPPostT = resp.BodyStr End If