我对使用 XMLHTTP 并尝试使用 Excel VBA 从我们公司的网站下载报告完全陌生。我似乎遇到的问题是该站点受 Siteminder 保护。我想我需要使用带有 GET 的 XMLHTTP.Open 但无论如何我尝试的只是我似乎得到的只是 Siteminder HTML 代码。因此,我尝试首先使用帖子将我的用户名和密码发送到 Siteminder,例如:
Function PostXmlData(vUrl As String, UserName As String, Password As String, xmlText
As String
Dim XMLHttp As Object
Set XMLHttp = CreateObject("MSXML2.XMLHTTP")
XMLHttp.Open "POST", vUrl, False, UserName, Password
XMLHttp.setRequestHeader "Content-Type", "text/xml;charset=utf-8"
XMLHttp.send (xmlText)
PostXmlData = XMLHttp.responseText
End Function
Sub Posttest ()
Dim add As String
Dim User As String
Dim Pass As String
Dim send As String
Dim ret As Variant
add = "https://mycompanywebsite.com/apps/application/Main/"
User = "username"
Pass = "password"
Send="DashboardId=http://mycompanywebsite.com/DAVCatalog/Dashboards/Teams/Client%20_
Extranet%20AM"
ret = PostXmlData(add, User, Pass, send)
End Sub
我是在正确的轨道上还是这甚至不可能?任何建议将不胜感激,或者如果有一些网站有人可以指导我,那将很有帮助。谢谢。