Sleep deprivation strikes again
Jeff Orrok (jeff@databright.com)
Wed, 21 Mar 2001 13:01:33 -0800
turns out the code is fine -- the test data had cqi instead of cgi.
Funny, I thought I had just copied and pasted it in when I did the
"hardcoded" test....
Jeff Orrok wrote:
>
> 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
> --
--
:-J
--