N
Naveen
Hi,
I have a simple subroutine which takes in a specified URL and a proxy
address from a list, and then verify whether that proxy is working for
the given URL. If it is working, then the content of the page is
displayed as output, else, error is reported.
#######
sub preview
{
$proxy=param('proxy');
print "$proxy-$url-<BR>";
require LWP::UserAgent;
$ua = new LWP::UserAgent;
#$ua->proxy( 'http', '$proxy');
$ua->proxy( ['http'] => "$proxy");
my $req = new HTTP::Request ('GET', "$url");
#print $ua->request($req)->as_string;
$res = $ua->request($req);
if ($res->is_success)
{
print $res->content;
}
else
{
print "Error: " . $res->status_line . "\n";
}
}
#######
But when i execute the above, i get the error "Error: 501 Protocol
scheme '' is not supported" (it does not seem to get the 'http' in the
code, shows the quotes minus the http). If i replace the 'http' with
anything else, then the output is displayed, but obviously, the page is
not being fetched through the proxy then....
Any clues....
Thanks
Naveen
I have a simple subroutine which takes in a specified URL and a proxy
address from a list, and then verify whether that proxy is working for
the given URL. If it is working, then the content of the page is
displayed as output, else, error is reported.
#######
sub preview
{
$proxy=param('proxy');
print "$proxy-$url-<BR>";
require LWP::UserAgent;
$ua = new LWP::UserAgent;
#$ua->proxy( 'http', '$proxy');
$ua->proxy( ['http'] => "$proxy");
my $req = new HTTP::Request ('GET', "$url");
#print $ua->request($req)->as_string;
$res = $ua->request($req);
if ($res->is_success)
{
print $res->content;
}
else
{
print "Error: " . $res->status_line . "\n";
}
}
#######
But when i execute the above, i get the error "Error: 501 Protocol
scheme '' is not supported" (it does not seem to get the 'http' in the
code, shows the quotes minus the http). If i replace the 'http' with
anything else, then the output is displayed, but obviously, the page is
not being fetched through the proxy then....
Any clues....
Thanks
Naveen