Hello,
Is there a reliable way to get cookies? Or can I capture the request header or command line tool?
Although I can get cookies by using "InternetGetCookieExW", it is not very reliable, and it often happens that nothing can be obtained.
Does anyone have any suggestions?
Thanks.
Is there a reliable way to get cookies?
Re: Is there a reliable way to get cookies?
From which application do You need cookies?
It is strange that InternetGetCookieExW does not work - post Your code here.
It is strange that InternetGetCookieExW does not work - post Your code here.
Re: Is there a reliable way to get cookies?
Such as the following example. It doesn't seem to be available from many websites.
Code: Select all
URL := "https://www.autohotkey.com/"
Cookie := GetCookie(URL)
msgbox % Cookie
return
GetCookie(ByRef str)
{
DllCall("Wininet.dll\InternetGetCookieExW"
, "ptr", &str
, "ptr", 0
, "ptr", 0
, "ptr*", Size
, "str", "INTERNET_COOKIE_HTTPONLY"
, "ptr", 0)
VarSetCapacity(CookieData, Size)
DllCall("Wininet.dll\InternetGetCookieExW"
, "ptr", &str
, "ptr", 0
, "ptr", &CookieData
, "ptr*", Size
, "str", "INTERNET_COOKIE_HTTPONLY"
, "ptr", 0)
return, StrGet(&CookieData)
}
Re: Is there a reliable way to get cookies?
It does not work because it is wrong.
Code: Select all
InternetGetCookieEx(URL) {
Loop, 2 {
if (A_Index = 2) {
VarSetCapacity(cookieData, size, 0)
}
DllCall( "Wininet.dll\InternetGetCookieEx"
, "ptr", &URL, "ptr", 0, "ptr", &cookieData, "int*", size
, "uint", 8192 ; INTERNET_COOKIE_HTTPONLY
, "ptr", 0 )
}
return StrGet(&cookieData)
}
Re: Is there a reliable way to get cookies?
Have you tried it? I tried your code and it still doesn't work.
Re: Is there a reliable way to get cookies?
For me it works.
Open site in IE and run this script.
Open site in IE and run this script.
Who is online
Users browsing this forum: Google [Bot], kingina and 205 guests