Thread LWP und proxy (52 answers)
Opened by perl-snaks at 2012-04-25 13:04

perl-snaks
 2012-04-25 13:02
#157832 #157832
User since
2012-04-19
54 Artikel
BenutzerIn
[default_avatar]
vielen Dank für die ausführliche Antwort.
Ich habe jetzt ein anderes Problem und zwar:
wenn ich diesen Perl-Skript in der Eingabeauforderung (Windows) ausführe, bekomme ich den Inhalt der cpan-Seite zurück.

Wenn ich diesen Skript im Browser ausführe, bekomme ich im Logfile die Fehlemeldung:

Code: (dl )
500 Can't connect to search.cpan.org:80 (Bad hostname) at C:/Programme/Apache/cgi-bin/parsetesta.pl line 20.\r


Ich habe diese Zeile:
Code: (dl )
$ua->protocols_allowed( [ 'http','https'],'http://surfproxy.prox:8080');
zum Skript hinzugefügt, kriege ich aber keine Inhalt zurück sowohl in der Eingabeaufforderung als auch im Browser und die Fehlermeldung ist gleich.

Hat jemand eine Idee woran es scheitert? wir benutzen in Firma Proxy.
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
print "Content-type:text/html\n\n";
 
use LWP::UserAgent;
 

 my $ua = LWP::UserAgent->new;
 $ua->timeout(10);
 $ua->protocols_allowed( [ 'http','https'],'http://surfproxy.prox:8080');
 #$ua->protocols_allowed( [ 'http','https'],'http://surfproxy.prox:8080');
 #$ua->env_proxy;
 

 my $response = $ua->get('http://search.cpan.org/');
 
 if ($response->is_success) {
     print $response->content;  # or whatever
 }
 else {
     die $response->status_line;
 }


Für jede Hilfe oder Hinweise werde ich mich sehr freuen.

soll ich ein neues Thread eröffnen?

Vielen Dank

modedit Editiert von GwenDragon: Logausgaben + Codezeilen bitte in CODE-Tags

Splitted from Ausgabe eines URLs parsen msg #157805
Last edited: 2012-04-25 13:42:32 +0200 (CEST)

View full thread LWP und proxy