HTTP-404 has asked for the wisdom of the Perl Monks concerning the following question:

i have this code it doesn't seem to work, or is it better to use sockets instead?
my $ua = new LWP::UserAgent; my $request = new HTTP::Request; $request->header('Content-Type' => 'application/x-www-form-urlen +coded'); $request->header('Content-Length' => length $content); $request->content($content); my $response = $ua->request($request);

Edit: chipmunk 2001-03-22

Replies are listed 'Best First'.
Re: POST with LWP
by arhuman (Vicar) on Mar 22, 2001 at 14:16 UTC
    Simple search would have give you some answers using :
    perldoc LWP:/UserAgent or HTTP::Request
    Super Search
    Cookbook

    Or from the lwpcook (via this Davorg's post):
    use HTTP::Request::Common qw(POST); use LWP::UserAgent; $ua = new LWP::UserAgent; my $req = POST 'http://www.perl.com/cgi-bin/BugGlimpse', [ search => 'www', errors => 0 ]; print $ua->request($req)->as_string;
    Now to answer our question stay with the LWP beccause it's powerful AND easy !!!

    "Trying to be a SMART lamer" (thanx to Merlyn ;-)
Re: POST with LWP
by merlyn (Sage) on Mar 22, 2001 at 19:38 UTC
      If it shouldn't have been said 20 times, we can exclude : "I have a column about that"

      ;-)