我需要从VB6进行一些GET和POST到RESTful Web服务。最好和最简单的方法是什么?

最佳答案

您需要添加对MSXML库的引用:

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

关于web-services - 获取/发布到RESTful Web服务,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/3516119/

10-17 02:40