Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: URI::Escape::escape_char error when posting to a form inside perl script

by kcott (Archbishop)
on Jan 31, 2013 at 05:59 UTC ( [id://1016222]=note: print w/replies, xml ) Need Help??


in reply to URI::Escape::escape_char error when posting to a form inside perl script

G'day marknher,

Welcome to the monastery.

According to the HTTP::Request::Common documentation, the request() method, when used with POST, takes its list of key-value pairs as an arrayref:

use HTTP::Request::Common; $ua = LWP::UserAgent->new; $ua->request(POST 'http://somewhere/foo', [foo => bar, bar => foo]);

You're using a hashref (\%Fields). I'd suggest changing your request() call to:

my $Page = $Browser->request(POST $URLtoPostTo, [%Fields]);

-- Ken

Replies are listed 'Best First'.
Re^2: URI::Escape::escape_char error when posting to a form inside perl script
by marknher (Initiate) on Jan 31, 2013 at 06:15 UTC
    Thank you Ken, I've updated my code to include [] around %fields. Unfortunately, the error remains. From what I can tell, it's because the scalars in the pairs have reserved characters such as @, etc. Any other ideas? Thanks, Mark T.

      Take a look at the code for URI::Escape which you'll probably find at /usr/local/share/perl/5.10.1/URI/Escape.pm. In the current source for this module, escape_char() is coded right at the end:

      ... sub escape_char { return join '', @URI::Escape::escapes{$_[0] =~ /(\C)/g}; } 1;

      If it's not there, you'll need to ask your server administrators to update their code. If it is there, please show the actual code you are running, i.e. with the calls to uri_escape() - the problem may lie with your implementation.

      -- Ken

        Thanks Ken, This would explain it. I put in the request to the support site for my host and we'll see. Thanks, Mark T.
      If I comment out one of the key-pairs that have a reserved character such as $email (which has @ in it) then the script works fine. Thanks, Mark

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1016222]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 21:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found