I’ll share how to save cookies and maintain sessions with curl.
I was having trouble maintaining sessions because curl was issuing new sessions every time I sent HTTP requests.
It seems curl doesn’t save cookies unless you use the -c option, so sessions couldn’t be maintained.
The solution is to use curl’s -c option to specify a file for saving cookies.
curl -c cookie.txt http://example.com/login
curl -b cookie.txt http://example.com/mypage
That’s all from wanting to save cookies and maintain sessions with curl from the Gemba.