Get/post to RESTful web service

Echo says Reinstate Monica picture Echo says Reinstate Monica · Aug 18, 2010 · Viewed 43.5k times · Source

I need to do some GETing and POSTing to a RESTful web service from VB6. What is the best and simplest way to do that?

Answer

Justin Niessner picture Justin Niessner · Aug 18, 2010

You'll need to add a reference to the MSXML library:

Dim sUrl As String
Dim response As String
Dim xmlhttp

Set sUrl = "http://my.domain.com/service/operation/param"

Set xmlhttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlhttp.open "POST", sURL, False
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send()

Dim response As String = xmlhttp.responseText

Set xmlhttp = Nothing