0

I've got a simple command to get a logged in page with all its dependencies:

wget --post-data='user=user&password=password' --page-requisites https://…/login

The server log shows the following (abbreviated for obvious reasons):

  1. POST /login 302
  2. GET /account 200
  3. POST /robots.txt 200 (should be a GET, but it succeeds, so no problem)
  4. POST /favicon.ico 200 (ditto)
  5. POST /[looong PageSpeed URL] 500 (for every CSS, JavaScript and image file on the page)

GETting these files works fine, so the URLs are correct, but it appears PageSpeed doesn't like clients POSTing. How can I make wget use GET for everything except the initial request?

Using GNU Wget 1.18.


Update: Bug submitted.

2

From 'man wget':

           This example shows how to log in to a server using POST and then proceed to download the desired pages, presumably only accessible to authorized
       users:

               # Log in to the server.  This can be done only once.
               wget --save-cookies cookies.txt \
                    --post-data 'user=foo&password=bar' \
                    http://example.com/auth.php

               # Now grab the page or pages we care about.
               wget --load-cookies cookies.txt \
                    -p http://example.com/interesting/article.php

       If the server is using session cookies to track user authentication, the above will not work because --save-cookies will not save them (and neither
       will browsers) and the cookies.txt file will be empty.  In that case use --keep-session-cookies along with --save-cookies to force saving of session
       cookies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.