1

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

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

使用 wget。这个命令:

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 到处乱逛,但无济于事。

提前致谢,

标记

4

1 回答 1

1

使用

$ 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-dumplibwww-mechanize-perl命令在 Debian 及其衍生版本下附带。

最后 :

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

(用您的输入替换 XXX)。这应该工作!

您可以使用LiveHttpHeadersfirefox 模块查看要重现的标题。

请参阅man curl以了解所有开关。

于 2012-12-20T20:57:49.447 回答