SPUG: HTTP Post

Sanford Morton smorton at pobox.com
Fri May 24 01:03:52 CDT 2002


I don't know what a POST reply is, but if you want to make a POST request of a
CGI script, here's a snippet.

  use LWP::UserAgent;
  my $ua = new LWP::UserAgent;
  my $req = new HTTP::Request ('POST',$url_that_demands_POST_data);
  $req->content_type('application/x-www-form-urlencoded');
  $req->content($urlencoded_form_content);
  my $resp = $ua->request($req);
  if ($resp->is_success) { 
    &do_something_with_the_response($resp) 
  } else { 
    die $resp->as_string;
  }

On Fri, 24 May 2002, Menardo, Dax (RBI - AUS) wrote:
>
> Has anybody created a post reply via HTTP in Perl CGI?
> 


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org




More information about the spug-list mailing list