DokuWiki

It's better when it's simple

User Tools

Site Tools


Sidebar

Translations of this page?:

Learn about DokuWiki

Advanced Use

Corporate Use

Our Community


Follow us on Facebook, Twitter and other social networks.

tips:curl_login

Logging in with cURL

Sometimes you might want to monitor or grab pages directly from scripts. It is easy, unless your DokuWiki installation requires logging in. In that case you can use cookie and POST variable support in curl.

Step 1 - log in and store cookie.

curl -d "u=<username>&p=<password>" --cookie-jar cjar http://www.my.wiki/path/?do=login

This stores login cookie in a file named cjar in the current directory. Now we can retrieve pages that require us to be logged in.

Step 2 - retrieve pages.

Now we can easily retrieve protected pages, but we still have to indicate to DokuWiki that we are the same person who logged in previously.

curl --cookie cjar --cookie-jar cjar http://www.my.wiki/path/that/requires/login

This reuses cookie from the cjar file and allows us to retrieve those pages.

tips/curl_login.txt · Last modified: 2009-09-08 14:26 by richlv