LPM: User authentication in perl?

David Hempy hempy at ket.org
Tue May 2 12:32:08 CDT 2000


I'm trying to fetch a page in perl that requires user authentication.  I 
think the following should work, but it doesn't.  I still get a 401 error 
from the server.


  use LWP::UserAgent;
  $ua = new LWP::UserAgent;
  $request = new HTTP::Request('GET',
         'http://www.dl.ket.org/cgi-sta/foxweb/Quiz@/db/sta/sta?courseid=LT1Y&quizid=LT1Y192&do=PRINT'
         );

  $ua->credentials('www.dl.ket.org', "KET DISTANCE LEARNING INTRANET", 
"dhempy", "mypassword");

  $response = $ua->request($request);
  $content = $response->content;

  print "Got Back:\n" . $response->code . ": ".  $response->message . 
"\n$content \n";




I'm believe I've got all the credentials exactly correct, but oddly enough, 
the hit isn't turning up in my access nor error logs.  I am getting the 401 
error page back from the server:

>Got Back:
>401: Unauthorized
><!-- This document was created with HomeSite 2.5 -->
><HTML>
>
><HEAD>
>
>         <TITLE>Distance Learning - Unauthorized</TITLE>
>...
<snip the rest of the error page>


Any ideas?

-dave


--
David Hempy
Internet Database Administrator
Kentucky Educational Television
<hempy at ket.org> -- (606)258-7164 -- (800)333-9764




More information about the Lexington-pm mailing list