1

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 Answers1

1

Using :

$ 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.

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
  • Wow, thanks. I got the mech-dump working, but am not sure what goes in /tmp/c. Would it be the part of the output of the mech-dump that you posted? – Jennifer Espinoza Dec 20 '12 at 21:29
  • No, that's part of `man curl` : the cookies. If you think that the answer is useful, you can 'upvote' it. You can 'accept' the reply too by clicking the outline of the `checkmark` (will be green), this way, people searching stackexchange website will known that the question is well answered. That's how stackechange websites works, thanks ;) – Gilles Quénot Dec 20 '12 at 21:39
  • OK, I think I can get it from here. Thank you very much. – Jennifer Espinoza Dec 20 '12 at 21:44