Leser: 3
|< 1 2 >| | 18 Einträge, 2 Seiten |
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
#!/usr/bin/perl -w use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new(); $ua->proxy(['http', 'ftp'], 'http://127.0.0.1:8118/'); my $url = 'http://rs208.rapidshare.com/files/47486343/PowerOptions.pdf'; my $request = HTTP::Request->new('GET', $url); my $response = $ua->request($request); my $content; if ( $response->is_error() ) { print "Error-Code : ", $response->code() , "\n"; print "Fehlermeldung: ", $response->message() , "\n"; } else { $content = $response->content(); } if ( $content =~ /\(\w+\s\w+\s(.*)\s\w+\)/i ) { print "Oder warte $1 Minuten."; } elsif ( $content =~ /Kein Premium-User/i ) { print "Kein Premium-User\n"; }
Du musst noch den Klick auf den "Free"-Button simulieren!
1
2
3
4
5
6
7
8
9
10
11
12
E:\perl>perl mech.pl
Bareword "Accept" not allowed while "strict subs" in use at mech.pl line 8.
Execution of mech.pl aborted due to compilation errors (#1)
(F) With "strict subs" in use, a bareword is only allowed as a
subroutine identifier, in curly brackets or to the left of the "=>"
symbol. Perhaps you need to predeclare a subroutine?
Uncaught exception from user code:
Bareword "Accept" not allowed while "strict subs" in use at mech.pl line
8.
Execution of mech.pl aborted due to compilation errors.
at mech.pl line 17
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl -w use strict; use diagnostics; use Data::Dumper; use WWW::Mechanize; my $mech = WWW::Mechanize->new; $mech->add_header( Accept-Language => 'de'); $mech->get('http://www.rapidshare.com/files/47486343/PowerOptions.pdf'); $mech->submit_form( button => 'dl.start', ); print $mech->content; print "Drin!\n" if $mech->content =~ /blablabla/;
|< 1 2 >| | 18 Einträge, 2 Seiten |