本文介绍了如何将表格数据发布到ASP页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我需要将表单数据发布到页面上看起来像这样的ASP页面 本身...... < form method =' 'POST''>< input src = \icons\devices\coffee-on.gif type =''image'' align =''absmiddle''width = 16 height = 16 title =''关闭''><输入类型=''隐藏'' value =''图像''name =''动作''><输入类型= ''hidden''value =''hs.ExecX10ByName " Kitchen Espresso Machine"," Off",100''>< / form> 我一直在尝试这个,但是我收到语法错误... params = urllib.urlencode({''hidden'':''hs.ExecX10ByName" Kitchen Espresso Machine"," On",100''}) urllib.urlopen(" http://192.168.1.11:80 / hact / kitchen.asp" ;,params) 有人可以帮忙并确认我是在正确/错误的轨道上并帮助 语法? 谢谢!I need to post form data to an ASP page that looks like this on the pageitself...<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 "KitchenEspresso Machine", "On", 100''})urllib.urlopen("http://192.168.1.11:80/hact/kitchen.asp", params)Can someone help out and validate I''m on the right/wrong track and help withthe syntax?thanks!推荐答案 urlencode不关心输入元素的类型(或者 页面i s ASP),只是名称/值对。你想: params = urllib.urlencode({''Action'':''Image'',...}) 提供的HTML没有说明第二个隐藏输入的名称是什么字段是什么。在这种情况下,在 中应该传递给服务器的内容一点也不清楚。 看起来你试图打破一个字符串行边界,但 可能是您的发布软件。如果你这样做了,那就是' 生成一个语法错误,并且你应该尝试阅读教程,这是一个很好的迹象。 。 < mike - Mike Meyer< mw*@mired.org> http://www.mired.org/home/mwm/ 独立的WWW / Perforce / FreeBSD / Unix顾问,电子邮件以获取更多信息。urlencode doesn''t care about the type of the input element (or thatthe 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 inputfield is. It''s not at all clear what should be passed to the server inthis case.It looks like you tried to break a string across a line boundary, butthat may be your posting software. If you did, then that''s what''sgenerating a syntax error, and a good indication that you should tryreading the tutorial.<mike--Mike Meyer <mw*@mired.org>http://www.mired.org/home/mwm/Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. urlencode并不关心输入元素的类型(或者页面是ASP),jus名称/值对。你想要: params = urllib.urlencode({''Action'':''Image'',...}) 提供的HTML不会说出第二个隐藏输入字段的名称是什么。在这种情况下,应该传递给服务器的内容一点也不清楚。 看起来你试图在一个线边界上打破一个字符串,但是这可能是你的发布软件。如果你这样做了,那就是产生语法错误的原因,以及你应该尝试阅读教程的好迹象。 < mike - Mike Meyer< mw*@mired.org> http://www.mired.org/home/mwm/ 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 <mw*@mired.org> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. 没有想法。什么是不工作意思?你有从 Python的回溯吗?如果是这样,分享它 - 因为我在这里看到的不是合法的Python。从 你从kitchen.asp表单处理程序得到一条错误消息?如果是这样的话, .... < mike - Mike Meyer < mw*@mired.org> http://www.mired.org/home/mwm/ 独立的WWW / Perforce / FreeBSD / Unix顾问,电子邮件以获取更多信息。No ideas. What does "not working" mean? Do you get a traceback fromPython? If so, share it - cause what I see here isn''t legal Python. Doyou get an error message from the kitchen.asp form handler? If so,....<mike--Mike Meyer <mw*@mired.org>http://www.mired.org/home/mwm/Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. 这篇关于如何将表格数据发布到ASP页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-05 12:39
查看更多