使用 VBA for Excel 的 HTTPS POST 请求
我使用“WinHttp.WinHttpRequest.5.1”从 Excel 中的 VBA 发送 HTTP POST 请求。 但我无法对 HTTPS 执行此操作,因为我收到了 SSL 证书错误。
您将使用什么 VBA 代码来协商从 Excel 中的 VBA 到网站的 SSL 连接?
I use "WinHttp.WinHttpRequest.5.1" to send HTTP POST requests from VBA in Excel.
But I could not manage to do it for HTTPS, as I received an SSL certificate error.
What VBA code would you use to negotiate an SSL connection to a website from VBA in Excel ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
WinHttpRequest 对象有一个 SetClientCertificate 方法。 尝试从 MSDN 获取此代码示例(我尝试将其改编为 VBA):
The WinHttpRequest object has a SetClientCertificate method. Try this code example taken from the MSDN (I tried to adapt it for VBA):
虽然我没有使用 COM 组件 (WinHttpRequest),但似乎您需要调用 SetClientCertificate 在调用发送之前,按照链接。
这有帮助吗?
While I have not used the COM component (WinHttpRequest), it seems you need a call to SetClientCertificate prior to calling send, as per the link.
Does that help?
我有同样的情况(从Excel中的VBA发送http请求); 我创建了三个对象:
--用于http请求类,
--将证书内容放入变量中,将其传递给
HttpReq.SetClientCertificate
,这样我就可以发送包含其公钥的请求证书,像往常一样,
PS我在 http://www.808.dk/?code 找到了一个脚本-simplewinhttprequest——在我的情况下效果很好,希望在你的情况下也能正常工作。
I have the same situation (send a http request from a VBA in Excel); I created three objects:
-- for the http request class, and
-- to get into a variable the certificate contents, to pass it to
HttpReq.SetClientCertificate
,So I can send the request including its public key certificate, as usual,
P.S. I found a script at http://www.808.dk/?code-simplewinhttprequest -- it worked fine in my case, hope in yours too.