在VBA等效卷曲? [英] Equivalent cURL in VBA?

查看:238
本文介绍了在VBA等效卷曲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的应用程序的API,让我做出卷曲要求它。 我需要落实到VBA这让我的桌面数据库可以开火卷曲请求,我的Web应用程序。

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.

curl -i --user admin@admin.com:password -X PUT -d "test=testing" https://mywebsite.com/api

我怎样才能在Access VBA实现这一点?我可以使用WinHttp.WinHtt prequest.5.1? 任何的例子吗? 谢谢 亚当,

How can i implement this in Access VBA? Can i use WinHttp.WinHttpRequest.5.1 ? Any examples? Thanks Adam,

推荐答案

现在解决了这个问题,大家好,效果很好。 对于其他民族的便利。

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)

这篇关于在VBA等效卷曲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆