Am 2008-05-27 14:35:27, schrieb Marco Scholtyssek: > Hallo Christian, > > ich habe curl mal ausprobiert. Jetzt habe ich eine Frage dazu: > > Wenn ich ein HTTP-Request per GET übergebe, ist mir klar wie das > funktioniert, aber wie mache ich das, wenn die Website den HTTP-Request > per POST erwartet? ----[ man 'wget' ]------------------------------------------------------ --post-data=string --post-file=file Use POST as the method for all HTTP requests and send the specified data in the request body. "--post-data" sends string as data, whereas "--post-file" sends the contents of file. Other than that, they work in exactly the same way. Please be aware that Wget needs to know the size of the POST data in advance. Therefore the argument to "--post-file" must be a regular file; specifying a FIFO or something like /dev/stdin won't work. It's not quite clear how to work around this limitation inherent in HTTP/1.0. Although HTTP/1.1 introduces chunked transfer that doesn't require knowing the request length in advance, a client can't use chunked unless it knows it's talking to an HTTP/1.1 server. And it can't know that until it receives a response, which in turn requires the request to have been completed -- a chicken-and-egg prob- lem. Note: if Wget is redirected after the POST request is com- pleted, it will not send the POST data to the redirected URL. This is because URLs that process POST often respond with a redirection to a regular page (although that's technically disallowed), which does not desire or accept POST. It is not yet clear that this behavior is optimal; if it doesn't work out, it will be changed. This example shows how to log 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://server.com/auth.php # Now grab the page or pages we care about. wget --load-cookies cookies.txt \ -p http://server.com/interesting/article.php ------------------------------------------------------------------------ Thanks, Greetings and nice Day Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ ##################### Debian GNU/Linux Consultant ##################### Michelle Konzack Apt. 917 ICQ #328449886 +49/177/9351947 50, rue de Soultz MSN LinuxMichi +33/6/61925193 67100 Strasbourg/France IRC #Debian (irc.icq.com)
Attachment:
signature.pgp
Description: Digital signature