how-to POST form data to ASP pages?

livin livin at
Sun Jan 1 11:35:38 EST 2006


Mike,
I'm not a coder really at all (I dabble with vbscript & jscript) but an 
asking for help to get this working.

I have tried this...

      params = urllib.urlencode({'action': 'hs.ExecX10ByName "Kitchen 
Espresso Machine", "On", 100'})
      urllib.urlopen("http://192.168.1.11:80/hact/kitchen.asp", params)

Can you suggest the correct code to get this working?

I appreciate the help!

Aaron






"Mike Meyer" <mwm at mired.org> wrote in message 
news:861wzzdtp6.fsf at bhuda.mired.org...
> "livin" <livin@@cox.net> writes:
>> I need to post form data to an ASP page that looks like this on the page
>> itself...
>> <form method='POST'><input src=\icons\devices\coffee-on.gif type='image'
>> align='absmiddle' width=16 height=16 title='Off'><input type='hidden'
>> value='Image' name='Action'><input type='hidden' value='hs.ExecX10ByName
>> "Kitchen Espresso Machine", "Off", 100'></form>
>> I've been trying this but I get a syntax error...
>>       params = urllib.urlencode({'hidden': 'hs.ExecX10ByName "Kitchen
>> Espresso Machine", "On", 100'})
>>       urllib.urlopen("http://192.168.1.11:80/hact/kitchen.asp", params)
>
> urlencode doesn't care about the type of the input element (or that
> the page is ASP), just the name/value pairs. You want:
>
>           params = urllib.urlencode({'Action': 'Image', ...})
>
> The provided HTML doesn't say what the name of the second hidden input
> field is. It's not at all clear what should be passed to the server in
> this case.
>
> It looks like you tried to break a string across a line boundary, but
> that may be your posting  software. If you did, then that's what's
> generating a syntax error, and a good indication that you should try
> reading the tutorial.
>
>        <mike
> -- 
> Mike Meyer <mwm at mired.org> http://www.mired.org/home/mwm/
> Independent WWW/Perforce/FreeBSD/Unix consultant, email for more 
> information. 





More information about the Python-list mailing list