我正在尝试将姓名,电子邮件地址和消息发布到此页面:
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搞砸了,但没有用。
提前致谢,
标记
答案 0 :(得分:1)
使用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
命令在Debian和衍生文件下随libwww-mechanize-perl
一起提供。
最后:
curl -A "Mozilla/5.0" -L -b cookies.txt -c cookies.txt -s -d "contactname=XXX&mail=XXXX&enquiry=XXXX&should_be_empty="
(用输入替换XXX)。这应该有效!
您可以使用LiveHttpHeaders
firefox模块查看要重现的标头。
请参阅man curl
了解所有开关。