Thread lwp und proxys (7 answers)
Opened by Mike at 2009-07-22 18:11

Gast Mike
 2009-07-22 18:11
#123473 #123473
Ohne den proxy bekomme ich die korrekte Antwort.
Sobald ichd ie Zeile mit dem Proxy einfpge bekomme ich aebr folgenden Fehler: 501 Protocol scheme '' is not supported.

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Create a user agent object
use LWP::UserAgent;
use strict;

my $ua = LWP::UserAgent->new;
$ua->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.0.11) Gecko/2009060215 Firefox/3.0.11 (.NET CLR 3.5.30729)");
$ua->proxy(['http'], '151.100.59.11:3128');

# Create a request
my $req = HTTP::Request->new(GET => 'http://www.google.com/');

$req->content_type('application/x-www-form-urlencoded');
$req->content('query=libwww-perl&mode=dist');

#Pass request to the user agent and get a response back
my $res = $ua->request($req);

my $httpResponse;

#Check the outcome of the response
if ($res->is_success) {
$httpResponse = $res->content;
}
else {
print $res->status_line, "\n";
}

View full thread lwp und proxys