denni has asked for the wisdom of the Perl Monks concerning the following question:

I've been unable to figure out how to get a "+" sign into my POST request. Below is my code:

------ code -----
use LWP::UserAgent; my $url = 'http://www.somewhere.se/cgi-bin/myscript.pl'; my $ua = LWP::UserAgent->new(); $ua->agent("MyBrowser"); # Create HTTP POST request my $request = HTTP::Request->new(POST => $url); $request->content_type('multipart/mixed; boundary=--gc0p4Jq0M2Yt08jU53 +4c0p'); $request->content('DataOne=A&DataTwo=1+&DataThree=20'); my $response = $ua->request($request);
---- end code -----

Now, what is important is that I'm able to send the "+" sign as a real plus sign. However, the receiver side will strip all + signs away, assuming they're spaces.

Isn't there any way of actually sending a plus sign to the receiving script, using LWP?

Need help,
Denni

2002-02-09 Edit by Corion - Changed formatted code to CODE tags.

Replies are listed 'Best First'.
Re: How do I include plus signs in POST LWP request
by gav^ (Curate) on Feb 09, 2002 at 16:37 UTC
    If you use HTTP::Request::Common it will handle this for you:
    use HTTP::Request::Common; my $ua = LWP::UserAgent->new; $ua->request(POST $url, [DataOne => 'A', DataTwo => '1+', DataThree => + 20]);

    gav^

Re: How do I include plus signs in POST LWP request
by BazB (Priest) on Feb 09, 2002 at 16:14 UTC
Re: How do I include plus signs in POST LWP request
by Juerd (Abbot) on Feb 09, 2002 at 21:38 UTC
    %2B