On Fri, 8 Mar 2002, Tony Lewis <[EMAIL PROTECTED]> wrote:

> As promised in my earlier note, there is a second feature I'm looking for
> in wget. This feature is the ability to automatically post to forms. I'm
> thinking of something along the lines of a command line argument like:
>
>   --auto-post=FILE
>
> where FILE would contain data such as:
>
> form=/cgi-bin/auth.cgi
> name="id" value="tony"
> name="pw" value="password"
>
> With this information, any time that wget encounters a form whose action is
> "/cgi-bin/auth.cgi", it will enqueue the submission of the form using the
> values provided for the fields "id" and "pw".

Now, why would wget do this?

wget could very well just download that page for you, you write the script
that parses the page to figure out which fields to fill in and then you
construct the post data and then you POST using a tool that supports it.

I really can't see any reason why wget would do everything this internally.

> Is there anything else that seems obvious that I'm overlooking? Any
> cautions about the sections of code I'll be working with?

Yes, probably: when the <form> tags contains enctype='multipart/form-data'
you need to build an entirely different data stream (RFC1867 is the key
here).

I wrote a basic "find the form info" script once. It is far from perfect, but
it does the job on most pages: http://curl.haxx.se/programs/formfind.txt

I'd also like to point out that curl already supports both regular HTTP POST
as well as multipart formposts.

-- 
      Daniel Stenberg - http://daniel.haxx.se - +46-705-44 31 77
   ech`echo xiun|tr nu oc|sed 'sx\([sx]\)\([xoi]\)xo un\2\1 is xg'`ol

Reply via email to