向此表单提交数据的 wget 命令是什么? [英] What is the wget command to submit data to this form?

查看:24
本文介绍了向此表单提交数据的 wget 命令是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将姓名、电子邮件地址和消息发布到此页面:

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

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

使用 wget.这个命令:

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"

保存此页面:

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

我尝试了 cookie 和会话 cookie,但无济于事.

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

提前致谢,

标记

推荐答案

使用 :

$ 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 命令带有 libwww-mechanize-perl 在 Debian 和衍生版本下.

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

最后:

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

(用您的输入替换 XXX).这应该有效!

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

您可以使用 LiveHttpHeaders firefox 模块查看要重现的标头.

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

查看 man curl 以了解所有开关.

See man curl to understand all the switches.

这篇关于向此表单提交数据的 wget 命令是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆