Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

login/password with LWP::Simple

Status
Not open for further replies.

defdefdef

Technical User
Jul 4, 2005
19
0
0
FR
Hi,
I need to parse a XML file which is in a protected folder.
Is it possible to include my login/password in LWP::Simple ???
Thanks,
 
Hi,
It's a XML file that I want to Parse.
I try to use use LWP::UserAgent;

$ua = LWP::UserAgent->new;
$req = HTTP::Request->new(GET => $link);
$req->authorization_basic('login', 'password');
$document = $ua->request($req)->as_string;

but ->as_string returns a text version of the document that I can't parse.
I tried to do : $document = $ua->request($req);
but there isan error.
 
why can't you parse the text version of the document?
 
usually I use :
my $link = "my $document = get($link);
my $xp = XML::XPath->new(xml => $document);

but with the authentification :
$ua = LWP::UserAgent->new;
my $link = "$req = HTTP::Request->new(GET => $link);
$req->authorization_basic('login', 'password');
$document = $ua->request($req)->as_string;
my $xp = XML::XPath->new(filename => $document);

I have an error with XPath (line 53) ??
any ideas,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top