in reply to Post with parameters using hash

try :
my $request = POST "http://www.server.com", \%hiddenhash ;

From perldoc LWP another way:
# Create a user agent object use LWP::UserAgent; $ua = new LWP::UserAgent; $ua->agent("AgentName/0.1 " . $ua->agent); # Create a request
*****
my $req = new HTTP::Request POST => 'http://www.perl.com/cgi- +bin/BugGlimpse'; $req->content_type('application/x-www-form-urlencoded'); $req->content('match=www&errors=0'); # Pass request to the user agent and get a response back my $res = $ua->request($req);
******
# Check the outcome of the response if ($res->is_success) { print $res->content; } else { print "Bad luck this time\n"; }

Replies are listed 'Best First'.
Re: Re: Post with parameters using hash
by Anonymous Monk on Mar 05, 2001 at 22:12 UTC
    Is there a way to do it using hash? I can't use your method because one of the formvalue contains & and = which would cause another error.

    And I can't just do this because I have to build a form parameters using a for loop.
    $request = POST "http://www.server.com", Content => [ $formname1 => ' +formvalue1', $formname2 => 'formvalue2' ];
    I have to build the parameters first using hash and do something like this. But this doesn't seem to be working.
    $request = POST "http://www.server.com", Content => [ %hiddenhash ];