Steve Sotis wrote:
> 
> I'm doing the following
> 
>                 my $ua = new LWP::UserAgent;
>                 my $remote_url = $SOME_URL;
>                 my $request = new HTTP::Request('POST', $remote_url);
> 
>                 $request->content_type('application/x-www-form-urlencoded');
> 
> then I'm constructing a string:
> 
>                 $stg = "this=" . $THAT;
> 
> where $THAT may have spaces, etc.
> 
> Doesn't the string need to be "escaped" before being passed, i.e. if it's
> 
> this=this and that
> 
> doesn't it need to be passed as
> 
> this=this%20and%20that
> 
> If so, isn't there a Perl function (or LWP) that I can pass $stg to?

There's URI::Escape module or try something similar yourself:

sub url_escape {
        my $str = shift;

return undef unless defined($str);
$str =~ s/([^;\/?:@&=+\$,A-Za-z0-9\-_.!~*'() ])/uc sprintf("%%%02x",ord($1))/eg;
$str =~ tr/ /+/;
return $str;

}

-- 
  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
 (_/   /  )    // //       DBE Collectibles   http://www.wgn.net/~dbe/
  / ) /--<  o // //      Mailto:[EMAIL PROTECTED]   http://dbecoll.webjump.com/
-/-' /___/_<_</_</_    http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to