use strict; use warnings; use WWW::Mechanize; use HTML::TreeBuilder; use open ':std',':encoding(UTF-8)'; my $entree = "propriete.config"; open(my $fh,'<',$entree) or die "Impossible d'ouvrir le fichier specifie"; my @config; my $i=0; while(my $line = <$fh>) { $config[$i] = $line; chomp $config[$i]; $i++; } #---------------------------------------------- my $mech = WWW::Mechanize->new(); my $url = 'https://cas.univ-paris13.fr/cas/login?service=https%3A%2F%2Fent.univ-paris13.fr'; $mech->get($url); $mech->field('username',$config[0]); $mech->field('password',$config[1]); $mech->click_button(name => 'submit'); print $mech->response->request->uri->as_string()."\n"; $mech->follow_link(url => '/applications/notes/'); #---------------------------------------------- close($fh); my $file = "notes.hebert"; open($fh,'>',$file); my $tree = HTML::TreeBuilder->new_from_content( $mech->content ); print $fh "Derniere actualisation de ".$file." le : ".localtime."\n\n"; print $fh $_->as_trimmed_text, $_->attr('class') eq 'ligneModule' ? "\n" : "\n\n" for $tree->look_down( _tag => 'div', class => qr/ligne/ ); close($fh); print "fini";