| [reply] |
Yes, HTTP::Request, HTTP::Request::Common, HTTP::Headers are the right modules for forming the 'POST' request. You also need something to send this request to the server, LWP::UserAgent is one of many modules you can use.
| [reply] |
Just to let you know, forms have something called "method" which could be a "post" or "get". The primary difference between th two is mostly for security. When the method is "get", and the submit button is clicked, then the url shows all the parameters of the form in clear text as part of the url. However, in a "post", it does not show, so one would mostly use this method for transmitting passwords which when submitted, does not show up as part of the url.
Thanks for the advice, but I have been pulling my hair apart to get the GET with form paramters working.
| [reply] |
Depending on your needs you may be able to use LWP::Simple.
Makes posting to a form very easy.
perl -MLWP::Simple -ne 'getprint("http://your_site.com/form.cgi?unsubs
+cribe=1&who=me" )'
Note though that any form variables that you want to submit to the form will have to be properly encoded.
Modules like URI::Escape can help with that though. :-)
Hope that helps.
Wonko
| [reply] [d/l] |
Wonko the sane : - I tried your command against google's website but does not work. Here is the command I used -
perl -MLWP::Simple -ne 'getprint("http://www.google.com
/search?hl=en&ie=UTF-8&oe=UTF8&q=test")'
.
The response was 403 Forbidden. What's wrong with this query ? | [reply] [d/l] |
I tried your command against google's website ... ...The response was 403 Forbidden. What's wrong with this query ?
Whats wrong is the google doesn't like the LWP User Agent and will always return 403 to any request with the LWP UA. See this email thread (which I found from a google search). You need to set the UA to something like 'Mozilla/3.142', which I don't believe is possible using LSP::Simple.
See doco on LWP and LWP::UserAgent
Dingus Enter any 47-digit prime number to continue.
| [reply] |
I tried your command against google's website ... ...The response was 403 Forbidden. What's wrong with this query ?
Whats wrong is the google doesn't like the LWP User Agent and will always return 403 to any request with the LWP UA. See this email thread (which I found from a google search). You need to set the UA to something like 'Mozilla/3.142', which I don't believe is possible using LWP::Simple.
See doco on LWP and LWP::UserAgent
Dingus Enter any 47-digit prime number to continue.
| [reply] |
Dingus => I was just using google.com as an example of my test. I am trying to locate any sample script that uses method GET for submitting a form using the HTTP::Request::Common method. Thanks
| [reply] |