#!/usr/bin/perl # # gabriel 2010/06/03 # # apt-get install libwww-mechanize-perl libwww-perl use strict; use WWW::Mechanize; use Data::Dumper; my $file_upload = $ARGV[0]; die "Usage /usr/lib/biblehal/biblehal-push file.bib" if not -f $file_upload; my $config_file = '/etc/refbase.conf'; my $connect_name = qx{ grep '\$adminLoginEmail =' $config_file | cut -f 2 -d "'" }; my $connect_pass = qx{ grep '\$adminLoginPass =' $config_file | cut -f 2 -d "'" }; chomp($connect_name, $connect_pass); # Création du bot my $url = 'http://localhost/'; # refbase server my $bot = WWW::Mechanize->new; # Hop, c'est parti, premiere page $bot->get($url); #--1 # #form numero 2 #
# Hop, seconde page, on choisis le second formulaire $bot->form_number(2); $bot->field('loginEmail', "$connect_name"); $bot->field('loginPassword', "$connect_pass"); $bot->submit; $bot->get('import.php'); $bot->form_number(2); $bot->field('uploadFile', "$file_upload"); $bot->submit; $bot->form_number(2); $bot->submit; #print $bot->content; __END__ --2 Importer suivre le lien --3 form numero 2 sur 3 --4