iy3iqw
Last Updated: February 25, 2016
·
13.91K
· jasonseney
Water

Use Curl to Login to a Site with Cookie Sessions

In "batch" (MS DOS) syntax

curl "http://mysite.com/login" ^
    --data-urlencode "rememberMe=true" ^
    --data-urlencode "email=aturing@foobar.com" ^
    --data-urlencode "password=secretpassword" ^
    --cookie "cookies.txt" ^
    --cookie-jar "cookies.txt" ^
    --location ^
    --verbose ^
    > "login_log.html"

curl "http://mysite.com/admin" ^
    --cookie "cookies.txt" ^
    --cookie-jar "cookies.txt" ^
    --head
Say Thanks
Respond
Filed Under