Post

linux curl read write cookies

linux curl read write cookies

When you’re scripting against a web app that uses session cookies, you need to persist the session between curl calls. This two-step pattern — save cookies on first request, send them on subsequent ones — is the standard approach. Without it, you’ll get logged out on every request.

  • Save cookies from website to a file
1
$ curl -c cookie-jar.txt https://test_website.com/;
  • Read cookies from file and send to website
1
$ curl -b cookie-jar.txt https://test_website.com/index
This post is licensed under CC BY 4.0 by the author.