Equivalent cURL in VBA?

前端 未结 1 1757
栀梦
栀梦 2020-11-28 08:20

I have an API for my application which allows me to make cURL requests to it. I need to implement this into VBA so my desktop database can fire CURL requests to my web app.<

相关标签:
1条回答
  • 2020-11-28 08:52

    Solved it now guys, works well. For other peoples convenience.

    TargetURL = "https://www.mysite.co.uk/app/api/v1/test"
    Set HTTPReq = CreateObject("WinHttp.WinHttpRequest.5.1")
    HTTPReq.Option(4) = 13056 '
    HTTPReq.Open "PUT", TargetURL, False
    HTTPReq.SetCredentials "user", "password", 0
    HTTPReq.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    HTTPReq.send ("test[status]=" & Forms!curl!Text0.Value & "&test2[status]=" & Text2.Value)
    MsgBox (HTTPReq.responseText)
    
    0 讨论(0)
提交回复
热议问题