On Thu, Oct 31, 2002 at 10:28:32AM -0500, Chris Pizzo wrote:
> Hi,
> I'm trying to post data to a server that requires a hidden form field.
> 
> This is what I'm doing:
> my $content = "info=somedata";
> my $rec_len = length($content);
> my $send_url = new URI::URL($url);
> my $hdrsend = new HTTP::Headers('Content-length' => $rec_len);
> $hdrsend->header('Content-type' => 'text/html');
> 
> my $reqest = new HTTP::Request('POST', $send_url, $hdrs, $content);
> my $uasend = new LWP::UserAgent;
> 
> my $resp = $uasend-> request($reqest);
> 

I always just did

$req = new HTTP::Request('POST',"http://foo.bar.com/path/";);
$req->content("info=somedata");

$ua = new LWP::UserAgent;
$res = $ua->request($req);

print $res->as_string;


Good luck,

Rob

> 
> The response I get back is:
> <h3>Exception encountered.</h3><pre>Form post has no value for key "info".
> Form values are: {}
> 
> If I create an HTML doc with a form it finds the data.  Is there something
> special I need to do to get a hidden form field?
> 
> Thanks,
> Chris
> 
> 

-- 
Robert Landrum
Systems Programmer

Reply via email to