我必须使用vba将HTTP发布请求发送到网页。我已经用下面的代码成功做到了。我面临的问题是每次我登录该页面时api密钥(授权)都在变化。因此它不能为常数。我可以通过任何方法拉(加密)授权密钥,并将requestHeaders的授权设置为变量以发送我的HTTP发布请求吗?
Sub WEBAPP()
Dim xmlhttp As New MSXML2.XMLHTTP60, myurl As String
myurl = "www.abc.com"
xmlhttp.Open "post", myurl, False
xmlhttp.setRequestHeader "authorization", "myEncryptedUsernameAndPassword" 'i need to set this as my variable
xmlhttp.setRequestHeader "content-type", "application/x-www-form-urlencoded"
xmlhttp.send "name=jack&company=google"
MsgBox (xmlhttp.responseText)
End Sub