本文来自于Thinkai’s Blog,thinkai也是我在ahk上面的引路人,对thinkai感兴趣的朋友请关注他的博客。
thinkai的博客简洁、有趣,即便是转载过来我也尽量保持作者原有的风格,主要是方便大家查阅。
thinkai的博客简洁、有趣,即便是转载过来我也尽量保持作者原有的风格,主要是方便大家查阅。
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 }
????