Wie bringt man „wget“ dazu, die GET-Methode zum Abrufen von Seitenanforderungen zu verwenden?

Wie bringt man „wget“ dazu, die GET-Methode zum Abrufen von Seitenanforderungen zu verwenden?

Ich habe einen einfachen Befehl, um eine angemeldete Seite mit allen Abhängigkeiten abzurufen:

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

Das Serverprotokoll zeigt Folgendes (aus offensichtlichen Gründen gekürzt):

  1. POST /Anmeldung 302
  2. GET /Konto 200
  3. POST /robots.txt 200 (sollte ein GET sein, aber es gelingt, also kein Problem)
  4. POST /favicon.ico 200 (ebenfalls)
  5. POST /[laaaange PageSpeed-URL]500 (für jede CSS-, JavaScript- und Bilddatei auf der Seite)

Das Abrufen dieser Dateien funktioniert einwandfrei, die URLs sind also korrekt, aber PageSpeed ​​mag es anscheinend nicht, wenn Clients POSTs senden.Wie kann ich wgetGET für alles außer der ersten Anfrage verwenden?

Verwende GNU Wget 1.18.


Aktualisieren:Insekteingereicht.

Antwort1

Von „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.

verwandte Informationen