Register now and start sharing your code snippets.
-->

Login to protected resources with curl

Shell Script (Bash) posted about 1 year ago by christian

Cookies are stored and retrieved from cookies.txt. Post data is set using the data switch:

   1  curl --cookie cookies.txt --cookie-jar cookies.txt --user-agent Mozilla/4.0 --data "user=xxxxx&password=xxxxx" http://www.com/login -v
   2  curl --cookie cookies.txt --user-agent Mozilla/4.0 http://www.com/protected/resource

Tagged curl, login, cookies