Log in and save cookie
Change USERNAME, PASSWORD and the url according to your setup.
curl --cookie cookies.txt --cookie-jar cookies.txt \ --data "u=USERNAME&p=PASSWORD" \ "http://localhost/doku.php?id=start&do=login§ok="
The content of the cookie.txt file will look like the followings.
$cat cookie.txt # Netscape HTTP Cookie File # https://curl.haxx.se/docs/http-cookies.html # This file was generated by libcurl! Edit at your own risk. #HttpOnly_localhost FALSE / FALSE 0 DWbf...XXb8...f6826 eA%3D...7C...%3D #HttpOnly_localhost FALSE / FALSE 0 DokuWiki lm47t7ric...bokac0l
Retrieve password protected page
Now, reuse the cookie.txt to indicate to DokuWiki that you are already logged in. From here, you can fetch any pages that require login.
curl --cookie cookies.txt \ "http://localhost/doku.php?id=private:my-private-page" \ > my-private-page.html
The fetched page will be stored in my-private-page.html.