using cgi form via http and extracting results
Ben Finney
bignose-hates-spam at and-benfinney-does-too.id.au
Mon Jan 5 20:45:50 EST 2004
On Mon, 05 Jan 2004 17:39:30 -0800, Tim Roberts wrote:
> bmgx <bmgx_no_sp at mgleesonprop.co.za> wrote:
>>1) Make an http connection to the remote script (http://server/script.cgi)
>>2) Fill out the html form (1x TEXT and 2x SELECT input fields)
>>3) Submit the form
>>4) extract the actual returned result. (using regex or something..)
>
> You don't actually need steps 1 and 2 at all.
True.
> HTTP transactions are all completely separate.
True (ignoring cookies for now).
> The results of a form submission are just a URL.
Usually false.
The result of most form submissions is an HTTP POST request, which
contains the URL and form content as separate data.
> If the form has fields "FromCurrency", "ToCurrency", and "Amount", all
> you have to do is this:
>
> http://www.currencyservice.com?FromCurrency=dollars&ToCurrency=pounds&Amount=15
This is only true if the form action is an HTTP GET request, which is a
rather insecure and ugly way to submit form data, and makes it
impossible to submit many kinds of data. HTTP POST is the recommended
method for submitting data to a CGI script.
> You don't have to HAVE the form source in order to submit a request.
True. You just need to construct the HTTP POST request correctly.
--
\ "It's a good thing we have gravity or else when birds died |
`\ they'd just stay right up there. Hunters would be all |
_o__) confused." -- Steven Wright |
Ben Finney <http://bignose.squidly.org/>
More information about the Python-list
mailing list