LWP::UserAgent and HTTP::Request with basic authentication...



I am by no means a perl pro but I am trying to take a url sent from a
form along with a integer and load the given number of URL's to
recache them in our cms system... here is what I have...

#!/usr/local/bin/perl
alarm(300);

use LWP::UserAgent;
use HTTP::Request;
use CGI qw/:all/;
my $query = new CGI;

my $URL = CleanUp($query->param('gURL'));
my $imgCount = CleanUp($query->param('imgCount'));

## Ok, now we can actually begin the refreshing
#
my $orig = $URL;
for(my $i=1; $i <= $imgCount; $i++) {
$URL =~ s/Itemnr=\d*//;
$URL =~ s/&nocache=1//;
$URL = $URL . "&Itemr=$i&nocache=1";
print "Re-Caching image($i) ";

## Here is where we want to authenticate the access to the edit
server
my $ua = LWP::UserAgent->new;
$ua->agent("MyAgent/1.0");
my $req = HTTP::Request->new(GET => $URL);
$req->authorization_basic('user', 'pass');
my $res = $ua->request($req);
my $content = $res;
if ($content) {
print "<a href='$URL' target='_new'><span class='good'>re-cached</
span></a><br />\n";
} else {
print "<a href='$URL' target='_new'><span class='error'><b>re-cach
failed</b></span></a><br />\n";
}
$URL = $orig;
}
exit(0);

Not working... any ideas?

.



Relevant Pages

  • Re: True Memory Use
    ... We had to actually measure our server (it can handle 1300 ... You have to measure it under load. ... Note that you have to expect 70 seconds for a reverse DNS lookup; ... But of course the GUI *does* consume cycles, so only load simulation is ...
    (microsoft.public.vc.mfc)
  • Re: the future of applications in JavaScript?
    ... more than one server has to be up for success. ... I can't imagine that a brower rendering engine needs to be hand written ... One is make the browser smarter and have longer load times ...
    (comp.lang.javascript)
  • Re: Can not change screen resolution (Fedora 5, gnome)
    ... It seems like I am not able to change my x server ... screen resolution from ... Load "extmod" ... Section "Monitor" ...
    (Fedora)
  • Re: Starting X - was Re: Vista / FreeBSD dual boot
    ... X connection to:0.0 broken (explicit kill or server shutdown) ... xorg-fonts-100dpi-7.3 X.Org 100dpi bitmap fonts ... Identifier "X.org Configured" ... Load "extmod" ...
    (freebsd-questions)
  • Re: loading html pages in frames
    ... >>> On the server when we click on the link we get a momentary ... the html file loads correctly in the same window. ... >>> to load it but I get the same behaviour as trying to load from the ... >>> temp->data virtual folder. ...
    (microsoft.public.inetserver.iis)