login about faq

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 Function
All 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.


asked Dec 28 '12 at 11:42

CyberAgent's gravatar image


edited Dec 28 '12 at 13:45

chilkat's gravatar image

chilkat ♦♦

Using Chilkat, it would look like this:

Function HTTPPost(sUrl,sRequest)

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

End Function


answered Dec 28 '12 at 13:56

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: Dec 28 '12 at 11:42

Seen: 2,171 times

Last updated: Dec 28 '12 at 13:56

powered by OSQA