bleary eyed
Jeff Orrok (jeff@databright.com)
Wed, 21 Mar 2001 00:51:59 -0800
It's past my bedtime, and I can't figure out why the following generates
a 404 error, when I cat into it a file with a url on a line followed by
a series of lines of the format field=value
But when I hardcode the url after the POST => instead of $_ and cat in
the same file, then it gives me the page.
Someone wanna help me?
while(<>){
chop;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new( POST => $_ );
$req->content_type('application/x-www-form-urlencoded');
$req->content('');
$latch = 0;
while(<>){
chop;
$req->add_content( ($latch?'&':'') . $_ );
$latch = 1;
} # while
my $res = $ua->request($req);
print "Content-Type: text/html\n\n";
print $res->content;
} # while
--
:-J
--