[Buffalo-pm] LWP help request

Jesse L Farinacci jlf27 at cse.Buffalo.EDU
Wed Jul 30 16:59:40 CDT 2003


hello gang--i'm running into a small problem that i can't seem to get around
involving LWP and authentication.  i'm wanting to build a robot that will go
and fetch a page from sprintpcs website which has my (relatively) current
minute usage..  i already have the script extracting and reporting the info
i want once the page is available, but i just can not fetch it..  ugh.

my very brief fetcher should be pretty self-explanatory:

use LWP::UserAgent;

use constant PHONE_NBR => 5555555555;
use constant PASSWORD  => 123456;

my $url = 'https://manage1.sprintpcs.com/Manage?target=MyCurrentUsage&action=current_usage';
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $url);
$req->authorization_basic(PHONE_NBR, PASSWORD);
my $res = $ua->request($req);

if ($res->is_success) {
  print $res->as_string;
} else {
  print "Failed: ", $res->status_line, "\n";
}
__END__


i've got the LWP with SSL properly configured, i've tested this out with
other https pages and it's working fine.  by i just can not get the proper
credentials working..  LWP doesn't seem smart enough (actually, it's me) to
handle the authorization validation ... does anyone have an idea?  i've tried
to harvest cookies from opera, netscape, and IE, for use with LWP but no
joy there either..

i'm not sure if it is even possible for me to POST to the main page, then
while still within that UserAgent to request the usage page :: perhaps the
uname / pword authentication will have passed from the POST and remain within
the context of the UA??  maybe i'm grasping at straws..

help!  :-)
-jlf

-- 
        "To live forever, or die in the attempt."

 Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/buffalo-pm/attachments/20030730/6d5a5577/attachment.bin


More information about the Buffalo-pm mailing list