wget has a mode capable of saving cookies.
The other day I thought it'd be interesting to have a local copy of a confluence wiki, to avoid hitting the internet every time I needed a howto. So, I've tried curl first and failed (probably my fault really). So, after a few tries, I managed to get a workflow in place.
First, we need to log in onto the site:
./wget -qO- --keep-session-cookies \ --save-cookies cookies.txt \ --post-data 'os_username=<user>&os_password=<user>' \ https://site.com/confluence/login.action
Here, you need to replace the user name and password with something meaningful. Please note that text must be escaped with something like this encoder.
The command will create a file
cookies.txt which will contain the session cookie. Now, all you need to do is to mirror the site:
./wget --load-cookies cookies.txt \ -mkxKEp \ -np \ https://site.com/confluence/display/PROJECT/
..and presto! you have the site mirrored locally!