#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new; $req->method("POST"); $req->uri("http://www.example.com"); $req->authorization_basic('user', 'password'); print $ua->request($req)->as_string;