【发布时间】:2019-10-08 05:46:28
【问题描述】:
我正在尝试使用 WinHttp.WinHttpRequest.5.1 提取网站数据。该网站需要登录,cookie 存储在 IE11 中。 WinHttp.WinHttpRequest.5.1 创建它自己的实例,因此不会登录到请求的网站。有没有办法在 WinHttp.WinHttpRequest.5.1 请求中使用来自 IE11 的活动 cookie?
myURL = "https://postman-echo.com/get?foo1=bar1&foo2=bar2"
Set oXMLHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
oXMLHttp.Open "GET", myURL , False
oXMLHttp.send
ohtmlFile.Write oXMLHttp.responseText
ohtmlFile.Close
【问题讨论】:
-
看看Retrieve ALL cookies from Internet Explorer。在答案中,cookie 是从 IE 文件夹中的文本文件中检索的。如果您只需要登录 API,我建议您直接在 HTTP 请求中传递所需的凭据。
标签: vbscript internet-explorer-11 winhttp winhttprequest