in reply to How can I stop a POST from url encoding.
There are two issues here:
Here is a small example that should do what you wanted:
---- kurt
- changing the http-version: The only way to do this that I have found is to set an Environment Variable
- url-encoding: Just set the content with the content method provided by HTTP::Request
Here is a small example that should do what you wanted:
Update:Please be careful when using the "trick" with the Environmant Vaiable, as I have seen it in the code not in any documentation. So I believe that this is an inofficial feature, which could disappear with a new version of LWP.use strict; sub BEGIN { # force HTTP version to 1.0 $ENV{PERL_LWP_USE_HTTP_10} = "1"; } use LWP::UserAgent; use HTTP::Request::Common qw(POST); my $ua = new LWP::UserAgent (); my $req = POST 'http://localhost:4443/test.pl'; $req->content("<user>john\@doe</user>"); print $req->as_string; my $response = $ua->request($req); print $response->as_string;
---- kurt
In Section
Seekers of Perl Wisdom