What is the wget command to submit data to this form?

主宰稳场 提交于 2019-12-23 04:01:47

问题


I am trying to post the name, email address, and message to this page:

http://zenlyzen.com/test1/index.php?main_page=contact_us

using wget. This command:

wget --post-data     'contactname=test&email=a@a.com&enquiry=testmessage' http://www.zenlyzen.com/test1/index.php?main_page=contact_us\&action=send%20method="post"

saves this page:

http://www.zenlyzen.com/wgettest.html

I've poked around with cookies and session cookies, to no avail.

Thanks in advance,

Mark


回答1:


Using curl :

$ mech-dump --forms 'http://zenlyzen.com/test1/index.php?main_page=contact_us'
(...)

POST http://zenlyzen.com/test1/index.php?main_page=contact_us&action=send&zenid=075b74c66fbc5a701712880eb31f39f3 [contact_us]
  securityToken=b48dfdc80002c49fa5f6b07f7dc9be65 (hidden readonly)
  contactname=                   (text)
  email=                         (text)
  enquiry=                       (textarea)
  should_be_empty=               (text)
  <NONAME>=<UNDEF>               (image)

(...)

mech-dump command comes with libwww-mechanize-perl under Debian and derivateds.

Finally :

curl -A "Mozilla/5.0" -L -b cookies.txt -c cookies.txt -s -d "contactname=XXX&mail=XXXX&enquiry=XXXX&should_be_empty="

(replace XXX with your inputs). This should work !

You can use LiveHttpHeaders firefox module to see the headers to reproduce.

See man curl to understand all the switches.



来源:https://stackoverflow.com/questions/13979630/what-is-the-wget-command-to-submit-data-to-this-form

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!