This topic contains 4 replies, has 3 voices, and was last updated by
February 22, 2018 at 1:24 am #94381
I would like to know on how to retrieve cookies on sample 2.
$URL = Invoke-WebRequest http://www.google.com
$URL = "http://www.google.com"
(Invoke-WebRequest -Uri $URL -SessionVariable Y -UseBasicParsing).Content | Out-File -FilePath C:\TEMP.txt
$URL.baseresponse.cookies, which show nothing
Does anyone have any suggestions?
Thanks in advance for any suggestions
February 22, 2018 at 1:32 am #94384KeymasterPoints: 1,638Rank: Community Hero
$y would include session state information, including cookies. Probably encoded.
Also, if no cookies were passed, there won't be any.
February 22, 2018 at 2:32 am #94386
On sample 1, cookies is created through Invoke-WebRequest.
On sample 2, cookies should also be created, but when I input following commands, which return nothing.
I would like to know any difference on how cookies are handled on sample 2 comparing with sample 1 and how to retrieve cookies under this situation for sample 2.
Do you have any suggestions?
Thank you very much for any suggestions (^v^)
February 23, 2018 at 3:53 pm #94497ParticipantPoints: 0Rank: Member
In sample 2 $url is just the string containing the URL you're accessing so will have no knowledge of cookies
$Y.cookis contains some information but not sure how to drill down into the actual cookies
February 23, 2018 at 4:33 pm #94500
On web-server side, I would like to know on how server looks at both following requests.
On the other words, do server make a connection log (successful) for both following requests?
Cookies is found for sample 1, but cookies is unknown for sample 2.
1) $URL = Invoke-WebRequest http://www.google.com
2) (Invoke-WebRequest -Uri $URL -SessionVariable Y -UseBasicParsing).Content | Out-File -FilePath C:\TEMP.txt
Do you have any suggestions on any difference on web connection from server side?
Thanks, to everyone very much for any suggestions (^v^)
The topic ‘How to retrieve cookies in PowerShell?’ is closed to new replies.