soldierdog has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
I am using xmlhttpreq and it is working perfect for everything except, e.g. GET but not with POST. My understanding is that I need to prepare the POST structure and put it in the name value pairs in the setRequestHeader() method.
Any help in preparing the POST structure with PERL would be most useful.
Thanks in advance.
Re: xmlhttpreq-setup POST Headers
by Joost (Canon) on May 11, 2005 at 16:21 UTC
|
The POST data formatting for www/x-www-form-urlencoded requests is just the same as the formatting for GET, only the data goes in the request body instead of at the end of the URL. You could use URI::Escape
use URI::Escape;
my $postbody;
while (my ($key,$value) = each %params) {
$postbody .= "&" if defined $postbody;
$postbody .= uri_escape($key)."=".uri_escape($value);
}
| [reply] [d/l] |
|
Thanks for the reply,
One question, I just did a search on CPAN and couldn't find URI::Escape. I'm probably missing something silly, could you point me in the right direction?
| [reply] |
|