Curl with postdata and cookies
Great for command-line logging into sites to pull content for whatever reason.
[code lang=”bash”]curl -c cookies.txt -d “username=username&password=password&action=login” -o /home/kale/outputfile.txt “http://www.domain.com/authenticated_page.php?foo=bar”[/code]
Of course, you’ll have to look at the source for the target location’s login page to see what variables it wants. I use it to grab a single Cacti-generated graph that is normally password protected, but I want to include a single graph on another site, so I cron’d a script to run a line similar to the above to log in and save it locally.