Perform HTTP Post from within Excel and Parse Results

前端 未结 4 1579
感动是毒
感动是毒 2020-12-14 23:26

I have access to an API. The API takes an XML post as input and then returns an XML response with the relevant data.

I want to

  1. Send the HTTP Post to
4条回答
  •  太阳男子
    2020-12-14 23:57

    I suggest to use WinHttp.WinHttpRequest.5.1 instead of MSXML2.XMLHTTP whenever you need windows authentication, because it allows you to use current user credential to login. Here is an example

    Dim http As Object
    Set http = CreateObject("WinHttp.WinHttpRequest.5.1")
    http.SetAutoLogonPolicy 0
    http.Open "POST", "http://myUrl.html?param1=value1", False
    http.setRequestHeader "Content-Type", "text/json"
    http.setRequestHeader "User-Agent", "Mozilla/5.0 (iPad; U; CPU OS 3_2_1 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Mobile/7B405"
    http.send ("")
    

    Reference: https://github.com/VBA-tools/VBA-Web/issues/15

提交回复
热议问题