Shammer's Philosophy

My private adversaria

How to get html required authentication by curl?

The command "curl" has a -c option and -b option. The option -c makes cookie filed into local disk. And the option -b is used the cookie file to connect web server. Then, the option -d enables to send post data. So, the following steps enables to access to the sites required authentication.

  1. curl -c cookie.txt -d user=$USER_NAME -d pass=$PASSWORD $URL
  2. curl -b cookie.txt $URL

The user and pass at the first step may be different per sites.