I would like to login via Wget onto a Wordpress website.
I have found on StackOverflow something related to basic authentication.
wget --save-cookies cookies.txt \
--post-data 'user=foo&password=bar' \
http://server.com/auth.php
and tried this with a WordPress site but did not work.
Try this. This worked for me for one of the Drupal projects I worked on sometime ago. Its answered by asciikewl on the Drupal thread https://drupal.org/node/118759
I've managed to get it working this way, using wget's own cookie handling: I'm also referencing the /user page, not a login block (not enabled on my site)
#!/bin/sh
site=http://your site url with a slash on the end/
name=ScriptUser
pass=somethingsecure
cookies=/tmp/cron-cookies.txt
wget -O /dev/null --save-cookies /tmp/ba-cookies.txt --keep-session-cookies --load-cookies $cookies "${site}user"
wget --keep-session-cookies --save-cookies $cookies --load-cookies $cookies -O /dev/null \
--post-data="name=$name&pass=$pass&op=Log%20in&form_id=user_login" \
"${site}user?destination=login_redirect"
wget --keep-session-cookies --save-cookies $cookies --load-cookies $cookies "${site}login_redirect"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With