using cgi form via http and extracting results

bmgx bmgx_no_sp at mgleesonprop.co.za
Tue Jan 6 18:42:26 CET 2004


How would one "create" post data so that I can skip the html form and 
access the submission script (in <form method="POST" action="SCRIPT">) 
directly. This is simple if the script uses GET as mentioned, but 
unfortunately this is not the case which is the very reason for my dilemma..

Ben Finney wrote:
> 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.
> 




More information about the Python-list mailing list