[Discuss] URL syntax of POST method for contents of files?

pw p.willis at telus.net
Wed Oct 1 20:22:11 PDT 2014


Hello,

For negotiating user ID and password with wget:

wget --user bigbob  --password multiv3xingw0rd  "http://..."

provides user id and password for both HTTP/S and FTP.

Good options for setting up your requests:

--keep-session-cookies
--save-cookies  <file>
--load-cookies  <file>
--user-agent  <accepted browser user agent string>

--body-file <file>

Saving cookies is sometimes required for a multi-page transaction.

User agent spoofing is necessary for sites that hate anything other than
the 3 main browsers.

The body file allows you to put all your multi-part mime posts into a
single payload file.

The man page for wget is very complete. It's probably the most
useful network tool for automating web retrieval scripts and avoids a
great deal of pointless programming. Wget just works.

There is also 'wput'  which is useful for automating FTP
uploads.

Peter

On 10/01/2014 10:49 AM, Alan W. Irwin wrote:

> Thanks, Peter, for pointing me to the wget possibility.
>
> There are a lot of authentication details I have to get right
> <http://wget.addictivecode.org/FrequentlyAskedQuestions#How_do_I_use_wget_to_download_pages_or_files_that_require_login.2Fpassword.3F>
>
> as well, but wget looks like a solid candidate.  Another one
> (suggested to me off list by someone else) I am going to try first is
> curl.  It turns out for the POST task that curl just has much more
> convenient "@" syntax for posting file contents.  But presumably the
> same sort of authentication details have to be done correctly in that
> case as well, and I haven't looked at the curl syntax for that yet.
>
> In sum, though, it looks like you (and the other guy that recommended
> the curl alternative) have put me on the right general track, and it
> is a much better feeling than when I was floundering around yesterday
> trying to understand what was meant by the SF "documentation" on
> POSTing wiki pages.
>
> Alan




More information about the Discuss mailing list