Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Is there any way to use LWP to retrieve webpages and POST data to them as well?

Replies are listed 'Best First'.
RE: LWP and POST
by Kasei (Novice) on Jan 06, 2000 at 06:20 UTC
    from the LWP documentation:
    # Create a request my $req = new HTTP::Request POST => 'http://www.perl.com/cgi-bin/BugGl +impse'; $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);
      OK, now how can one know if the call succeded or failed and how it failed?
        Did you ever get an answer on this? Looks like not publically, at least.

        The object stored in $res (as given in the above example) has methods you can get at to find out what you want to know. Try this after the code Kasei provided:

        if ($res->is_success) { print $res->content; } else { print $res->error_as_HTML; }

        I hope you can extract from that sample; let me know if you need more info. By the way, I really like Web Client Programming with Perl but, alas, it's no longer in print. Betcha could find a used copy out there somewhere.

             - Muse