Leser: 1
10 Einträge, 1 Seite |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use HTML::LinkExtor; my $url = 'http://www.perl-community.de/'; my $content; sub connect { $content = get($url); return $content; } &connect(); my $p = HTML::LinkExtor->new(); $p->parse_file($content); if($p->links) { print $p->links; }
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
#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use HTML::LinkExtor; my $url = 'http://www.perl-community.de/'; my $content; sub connect { $content = get($url); open(FH,">index.html"); print FH $content; close(FH); } sub cb { my($tag, %links) = @_; print %links , "\n"; } &connect(); my $p = HTML::LinkExtor->new(\&cb); $p->parse_file("index.html");
hrefhttp://perlmongers.de/?StuttgartPM
http://perlmongers.de/?StuttgartPM
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
#!/usr/bin/perl use strict; use warnings; use LWP::Simple; use HTML::LinkExtor; my $url = 'http://www.perl-community.de/'; my $content; sub connect { $content = get($url); open(FH,">index.html"); print FH $content; close(FH); } sub cb { my($tag, %links) = @_; while ( my ($key, $value) = each (%links)) { if($value) { print $value , "\n"; } else { print "[-] nix gefunden glaub ich"; } } } &connect(); my $p = HTML::LinkExtor->new(\&cb); $p->parse_file("index.html"); unlink("index.html");
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#!/usr/bin/perl use strict; use warnings; use HTML::LinkExtor; use LWP::Simple; use Data::Dumper; my $url = 'http://www.perl-community.de'; my $content = get( $url ); my $link_extor = HTML::LinkExtor->new; $link_extor->parse( $content ); my @links = $link_extor->links; for my $link ( @links ){ print $link->[2],"\n"; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; my %hash; print Dumper \%hash; $hash{test} = 'Hallo Welt'; print Dumper \%hash; $hash{arraytest} = [qw/Dies ist ein Test/]; print Dumper \%hash;
10 Einträge, 1 Seite |