Leser: 4
|< 1 2 3 4 >| | 35 Einträge, 4 Seiten |
jogi+2007-10-12 12:26:07--Stimmt, wenn der Proxy nicht erreichbar ist kommt es zur Fehlermeldung.
Was mich jetzt aber stört ist die Antwortzeit. Rufe das Skript mal mit diesem Proxy auf: http://213.114.239.219/
Es dauert 25 Sekunden bis zur Ausgabe. Woran liegt denn das schon wieder?
$mech->timeout(10);
QuoteCan't call method "find_input" on an undefined value at C:/Perl/site/lib/WWW/Mec
hanize.pm line 1586.
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
#!/usr/bin/perl #use strict; #use warnings; #use diagnostics; use HTTP::ProxyCheck; use WWW::Mechanize; my $url = "http://www.rapidshare.com"; open (FILE, "<proxies.txt") or die $!; while (my $proxy = <FILE>) { chomp $proxy; my $proxy_check = new HTTP::ProxyCheck( proxy => $proxy, url => $url, answer_size => 'short', print_error => 0, ) or die $HTTP::ProxyCheck::error; print "Trying to connect to '$proxy' and retrieve '$url'\n"; if ( $proxy_check->check() ) { my $answer = $proxy_check->get_answer(); print "'$proxy' returns:\n\n", $answer, "\n\n"; if ($answer =~ /HTTP\/1.0 200 OK/ or $answer =~ /HTTP\/1.1 200 OK/) { my $mech = WWW::Mechanize->new; $mech->timeout(10); $mech->add_header( 'accept-language' => 'de') or die(); $mech->proxy(['http', 'ftp'], 'http://$proxy/') or die(); $mech->get("http://www.rapidshare.com/files/47486343/PowerOptions.pdf") or die(); $mech->click_button( number => '2' ) or die(); warn $mech->content; my $content = $mech->content; if ( $content =~ /\(\w+\s\w+\s(.*)\s\w+\)/i ) { print "warte $1 Minute(n).\n"; } elsif ( $content =~ /Kein Premium-User/i ) { print "Kein Premium-User.\n"; } elsif ( $content =~ /Zu viele Benutzer laden gerade Dateien runter./i ) { print "Zu viele Benutzer laden gerade Dateien runter.\n" } elsif ( $content =~ /Du musst warten, bis der Download fertig ist./i ) { print "Du musst warten, bis der Download fertig ist.\n" } else { print "Unknown error"; } } } else { print "Error: ", $proxy_check->get_error(), "\n"; } } close (FILE); exit;
'http://$proxy/'
"http://$proxy/"
QuoteE:\perl>perl check.pl
Trying to connect to '212.241.168.186:80' and retrieve 'http://www.rapidshare.co/
m'
'212.241.168.186:80' returns:
HTTP/1.1 200 OK
Can't call method "find_input" on an undefined value at C:/Perl/site/lib/WWW/Mec
hanize.pm line 1586.
warn $mech->content
QuoteE:\perl>perl check.pl
Trying to connect to '212.241.168.186:80' and retrieve 'http://www.rapidshare.co/
m'
'212.241.168.186:80' returns:
HTTP/1.1 200 OK
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /files/47486343/PowerOptions.pdf was not found on this serv
er.</p>
<hr>
<address>Apache/2.2.3 (CentOS) Server at www.rapidshare.com Port 80</address>
</body></html>
Can't call method "find_input" on an undefined value at C:/Perl/site/lib/WWW/Mec
hanize.pm line 1586.
|< 1 2 3 4 >| | 35 Einträge, 4 Seiten |