#!/usr/bin/perl -w # ecrit et verifie au 19 oct 2004 use strict; use WWW::Mechanize; use Getopt::Long; if ( $#ARGV == -1 ) { print( "Syntaxe: perl bouygtelsms.pl -from 06xxxxxxxx -to 06xxxxxxxx -pass xxxx -msg 'mon message' [-pay]\n\n" ); print( "Pour obtenir votre mot de passe, il faut etre client Bouygtel et aller s'inscrire ici :\nhttp://www.services2.bouyguestelecom.fr/inscription/InscriptionSaisieCodeClient.asp\n" ); print( "Rappel: Bouygtel offre 1 SMS par jour a destination d'un numero bouygtel\nSi vous souhaitez envoyer plusieurs SMS par jour, ou envoyer un SMS au numero d'un autre operateur, vous devrez specifier l'option -pay\n" ); exit 1; } my $from = 06; my $to = 06; my $password = ""; my $msg = ""; my $pay = 0; # process des options my $result=GetOptions( "from=i"=> \$from, "to=i" => \$to, "pass=i"=> \$password, "msg=s" => \$msg, "pay" => \$pay ); if ( $ARGV[0] ) { foreach (@ARGV) { print "$_ "; } print "\n"; die "ERREUR: Options incorrectes\n"; } if ( ( length( $from ) != 10 ) || ( length( $to ) != 10 ) ) { die( "ERREUR: Les numeros de telephone doivent comporter 10 chiffres\n" ); } if ( length( $msg ) > 160 ) { die( "ERREUR: Message trop long (maxi 160 caracteres) : " . length( $msg ) . "\n" ); } if ( length( $msg ) == 0 ) { die( "ERREUR: Il faut entrer un message\n" ); } if ( length( $password ) == 0 ) { die( "ERREUR: Il faut entrer un password\n" ); } # ok c'est parti my $mech = WWW::Mechanize->new(autocheck => 1); $mech->get( "http://www.bouygtel.com/home.htm" ); $mech->follow_link( text => "Envoyer des SMS"); $mech->submit(); # ca fait un submit vers /afficherLogin.asp #$mech->current_form()->action("/verifPassword.asp"); my $html = $mech->content; # ajout de l'action /verifPassword.asp $html =~ s[