Skip to main content

post request with authentication in perl

Note to myself to make a POST request in perl.

use LWP::UserAgent;
$ua = LWP::UserAgent->new;
  $req = HTTP::Request->new(POST => 'http://somesite;
  $req->authorization_basic('user', 'pass');
  $req->header('Content-Type' => 'application/xml');
  $req->content(request values);
 
 

  $res = $ua->request($req);


Reading the result is similar to php

Comments