I searched a lot on Google as well as Stackoverflow. I could not find How to get Cookies (or in general, The HTTP Headers)from a Webpage and then edit it and send it back?
[I know how to make POST/GET requests using read/write but Cookies idk]
Even with the current temporary IO support, you can still extract HTTP headers and cookies info:
red>> data: read/info http://microsoft.com
== [200 #(
Cache-Control: "no-cache, no-store"
Connection: "keep-alive"
Date: "Wed,...
red>> list: data/2/set-cookie
== [{MS-CV=z/YnyU+5wE2gT8S1.1; domain=.microsoft.com; expires=Thu, 24-Mar-2016 10:59:39 GMT; pa...
red>> foreach str list [probe parse str [collect [keep to "=" skip keep to [";" | end]]]]
["MS-CV" "z/YnyU+5wE2gT8S1.1"]
["MS-CV" "z/YnyU+5wE2gT8S1.2"]
The HTTP headers are stored in a map!, so if several Set-Cookie
headers are sent, you will get a block of strings, else just a string for the Set-Cookie
key.
read/info
will return a block with 3 elements:
Notes:
read
and write
.cookies are just a field in the response header
did you try "the library people"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With