Get/post to RESTful web service

前端 未结 3 1465
北海茫月
北海茫月 2020-12-01 11:09

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?

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-01 11:35

    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
    

提交回复
热议问题