The easy way: login with your browser,and give the cookies to wget
Easiest method: in general, you need to provide wget or curl with the (logged-in) cookies from a particular website for them to fetch pages as if you were logged in.
If you are using Firefox, it's easy to do via the Export Cookies add-on. Install the add-on, and:
- Go to Tools...Export Cookies, and save the
cookies.txt file (you can change the filename/destination).
Open up a terminal, and use
wget with the
--load-cookies=FILENAME option, e.g.
wget --load-cookies=cookies.txt http://en.wikipedia.org/wiki/User:A
- For curl, it's
curl --cookie cookies.txt ...
(I will try to update this answer for Chrome/Chromium users)
The hard way: use curl (preferably) or wget to manage the entire session
- A detailed how-to is beyond the scope of this answer, but you use curl with the
--cookie-jar or wget with the
--save-cookies --keep-session-cookiesoptions, along with the HTTP/S PUT method to log in to a site, save the login cookies, and then use them to simulate a browser.
- Needless to say, this requires going through the HTML source for the login page (get input field names, etc.), and is often difficult to get to work for sites using anything beyond simple login/password authentication.
- Tip: if you go this route, it is often much simpler to deal with the mobile version of a website (if available), at least for the authentication step.