此代码只可获取2行来自header的set-cookie字段$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$url = "https://passport.jd.com/new/login.aspx?ReturnUrl=http%3A%2F%2Fwww.jd.com%2F"
$oHTTP.Open("GET", $url, False)
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
;$oHTTP.setRequestHeader("Accept-Encoding", "gzip, deflate")
$oHTTP.setRequestHeader("User-Agent", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)")
$oHTTP.setRequestHeader("Referer", "Referer:https://passport.jd.com/new/login.aspx?ReturnUrl=http%3A%2F%2Fwww.jd.com%2F")
$oHTTP.Send()
$a100 = ($oHTTP.GetAllResponseHeaders)
MsgBox(0, "", $a100)
和以下信息相同:
但浏览器进行了再次处理 实际cookie为
因模拟登陆需要这些处理后的cookie
但winhttp是无法自动处理cookie的
如何得到页面加载后的cookie呢 用IE是可以正常的获取 但winhttp没有找到方法得到 |