my $ua = new LWP::UserAgent;
if ($useproxy) {
if ($use_randomproxy) {
&GetProxy;
$ua->proxy("http","$randomproxy");}
else {$ua->proxy("http","$defaultproxy"); }
}
Both $randomproxy and $defaultproxy contain [the_proxy_name:port_to_use...]
The response on the server is 501 when trying to go through a proxy , method not implemented. The log file doesn't show any errors.
Could this have to do with a missing or different module, apache version or am I missing something really simple ?
$proxyport ="8000";
$proxyadr ="1.2.3.4";#ip
$proxyadr ="http://$proxyadr:$proxyport/";
sub grab_www_page {
my $url = shift;
my $doc ="";
my $www_error =0;
my $status =0;
my $ct =0;
if (!$ouragent) {
$ouragent= 'Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.0)';
}
my $ua = new LWP::UserAgent;
$ua->proxy('http', $proxyadr) if length($proxyadr) >4;
$ua->timeout(45);
$ua->agent($ouragent);
my $req = HTTP::Request->new(GET => $url);
$req->referer($refer) if $refer;
my $res = $ua->request($req);
$realurl = $res->request->url;
$doc = $res->content;
$ct = $res->content_type;
if ($res->is_success) {
$status = $res->code();
$www_error =0;
}
else {
$status = $res->code();
$www_error =1;
}
return($doc,$ct,$status,$www_error,$realurl)
}
I dont' have and cannot install LWP modules on the server on which I wish to use a script via an http proxy.
Any help would be appreciated