[MLUG] perl/http auth question

nowlind nowlind at missouri.edu
Mon Oct 8 16:14:38 CDT 2007


Not sure if this will help but this is what I use in a perl program that 
I wrote to login to my router.  It is used in a dyndns updater:

  $browser->agent( $agent );
  $browser = LWP::UserAgent->new;
  $req = HTTP::Request->new(GET => $url);
  $req->authorization_basic($conf{"login"}, $conf{"password"});
  $responce = $browser->request($req);
  $code = $responce->code;
  $msg = $responce->message;
  $content = $responce->content;
  error_rtn("Error sending update: $code $msg $content") unless 
$browser->request($req)->is_success;


Rick wrote:
> I've got a script that I'm re-writing in perl to post a set of XML to a
> location. My question is what is the (best?) method to do this when the
> location I'm posting to requires authentication? Is there a best method?
>
> I keep seeing references to an HTTP::Request->authentication_basic
> method, but can't seem to find much information about using it for a
> POST.
>
> Anyone have a suggestion?
>
> Rick
>   

-- 
Daniel Nowlin
DataCenter




More information about the members mailing list