cookies获取问题
#include <IE.au3>#include "WinHttp.au3"
Opt("MustDeclareVars", 1)
;方法1
$Url = "http://www.autoitx.com"
$oIE = _IECreate ($URL,0)
$Obj = _IEDocGetObj($oIE)
$Cookie = $Obj.cookie
;方法2
; Open needed handles
Global $hOpen = _WinHttpOpen()
Global $hConnect = _WinHttpConnect($hOpen, "www.autoitx.com")
; Specify the reguest:
Global $hRequest = _WinHttpOpenRequest($hConnect, Default, "/")
; Send request
_WinHttpSendRequest($hRequest)
; Wait for the response
_WinHttpReceiveResponse($hRequest)
;MsgBox(0,'',_WinHttpQueryOption($hOpen,$WINHTTP_QUERY_COOKIE))
Global $sHeader
; If there is data available...
If _WinHttpQueryDataAvailable($hRequest) Then $sHeader = _WinHttpQueryHeaders($hRequest,43,Default,0) ; ...get full header
; Clean
_WinHttpCloseHandle($hRequest)
_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)
; Display retrieved header
MsgBox(0, "Header", $sHeader & @CRLF & "------" & @CRLF & $Cookie)
为什么2种方法获取的cookies会不一样呢?急求解 帮你顶
不太理解$Obj.cookie
望高手解释下 我也不懂,望高手解释下 回复 1# henrybond
当然不一样,第一种方法是从ie页面获取cookie,这个cookie是多次get或者post后服务器返回的cookie的总和,而第二种方法则只是获得单次服务器返回的cookie(在Set-cookie字段里)。 回复 4# papapa314
原来如此,谢谢 看贴不回贴 都什么习惯呀? http://pimg.163.com/club/newclub/images/PP0.gif
http://qb.lqualyn.com/images/sigline.gif
长春哪卖防辐射服 谢谢1楼让我知道获取cookie的方法谢谢4楼 让我知道了 两种方法的区别{:face (411):}
页:
[1]