GetCookie(){ static url, ua ;链接,user-agent if !url url := "http://shop.xj.189.cn:8081/xjwt_webapp/RechangeController/index.do?params=Y2hhbm5lbElkPThhODI4YjQ1NGUzZjIwMTIwMTRlNDdlYjZjYWUwMDBh&fastcode=10000321" if !ua ua := "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.84 Safari/535.11 LBBROWSER" ;设置request-header headers := {"Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8","Upgrade-Insecure-Requests":"1","Accept-Encoding":"gzip,deflate","Accept-Language":"zh-CN,zh;q=0.8","Host":"shop.xj.189.cn:8081","User-Agent":ua} hObject:=ComObjCreate("WinHttp.WinHttpRequest.5.1") Try { hObject.Open("GET",url) ;get/post for k,v in headers ;设置请求头 hObject.SetRequestHeader(k, v) hObject.Send() hObject.WaitForResponse(-1) } hds := hObject.GetAllResponseHeaders() ;获取所有cookie cookie := "" Loop, Parse, hds, `n, `r { if RegExMatch(A_LoopField,"Set-Cookie:([^;]*;)",m) cookie .= m1 } return cookie }
62 queries in 2.027 seconds |