I am using bash to to POST to a website that requires that I be logged in first. So I need to send the request with login cookie. So I tried logging in and keeping the cooki
In Chrome:
In the terminal
--cookie "cookiename=cookievalue"
to your curl request.This will give you the curl command for the action you triggered, fully populated with cookies and all. You can of course also copy the flags as a basis for new curl commands.
There's an even easier way to do this in Chrome/Chromium.
The open source Chrome extension
cookies.txt exports cookie data in a cookies.txt file, and generates an optional ready-made wget command.
*I have nothing to do with the extension, it just works really well.
I was curious if others were reporting that chrome doesn't allow "copy as curl" feature to have cookies anymore.
It then occurred to me that this is like a security idea. If you visit example.com
, copying requests as curl to example.com
will have cookies. However, copying requests to other domains or subdomains will sanitize the cookies. a.example.com
or test.com
will not have cookies for example.