how-to POST form data to ASP pages?
Alan Kennedy
alanmk at hotmail.com
Sun Jan 1 12:20:04 EST 2006
[livin]
> 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)
You should try to phrase your question so that it is easier for us to
understand what is going wrong, and thus help you to correct it.
As Mike already suggested, you have a string that may be spread over two
lines, which would be illegal python syntax, and which would give a
SyntaxError if run. You should be sure that this is not the cause of
your problem before going further.
The following code should do the same as the above, but not suffer from
the line breaks problem.
name_value_pairs = {
'action': 'hs.ExecX10ByName "Kitchen Espresso Machine", "On", 100'
}
params = urllib.urlencode(name_value_pairs)
urllib.urlopen("http://192.168.1.11:80/hact/kitchen.asp", params)
BTW, it looks to me like you may be opening up a security hole in your
application. The following string looks very like a VB function
invocation: 'hs.ExecX10ByName "Kitchen Espresso Machine", "On", 100'
Are you executing the contents of form input fields as program code?
That's highly inadvisable from a security point of view.
Happy New Year.
--
alan kennedy
------------------------------------------------------
email alan: http://xhaus.com/contact/alan
More information about the Python-list
mailing list