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)
Maybe with the wget cookie handling you can recurse the site.
For WordPress, you’re only missing a tiny bit, which is the
testcookie=1
. Also you probably need a User-Agent otherwise you may receive a “403 Forbidden” response.So all together the script should be:
Pro tip:
using Chrome Developers tools, in the “Network” tab, you can “Copy as cURL”, which is not too far from wget format.