Vous souhaitez développer une application en Perl qui permet d'envoyer des SMS ? Consultez nos exemples de codes pour chacune des fonctionnalités disponibles depuis notre API SMS.

				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/message/send';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'text' => 'Nouveau message via l'API d'Envoyer SMS Pro depuis un script PERL','recipients' => '33600000000', 'sendername' => 'SOCIETE'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Message envoyé!\n\n";
								
										print "Le messageid : " . $xml->findvalue('/envoyersmspro/message/message_id') . "\n";
										print "Nombre de SMS envoyé : " . $xml->findvalue('/envoyersmspro/message/sms_sent') . "\n";
										print "Nombre de SMS restants : " . $xml->findvalue('/envoyersmspro/message/sms_remaining') . "\n";
									}
									else
									{
										print "Impossible d'envoyer le message :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/message/stats';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'messageid' => '0'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Premières statistiques du message :\n\n";
								
										print "Nombre de SMS reçu : " . $xml->findvalue('/envoyersmspro/stats/number_status_1') . "\n";
										print "Nombre de SMS non délivré : " . $xml->findvalue('/envoyersmspro/stats/number_status_2') . "\n";
										print "Nombre de SMS en attente chez l'opérateur : " . $xml->findvalue('/envoyersmspro/stats/number_status_3') . "\n";
										print "Nombre de SMS en cours de traitement : " . $xml->findvalue('/envoyersmspro/stats/number_status_4') . "\n";
										print "Nombre de numéro en STOP SMS : " . $xml->findvalue('/envoyersmspro/stats/number_status_5') . "\n";
								
										print "\nDétails par destinataires :\n\n";
								
										for my $recipient ($xml->findnodes('/envoyersmspro/stats/recipient'))
										{
											print "Le numéro " . $recipient->findvalue('./mobile_number');
											if($recipient->findvalue('./status_id') eq "1")
											{
												print " a reçu le SMS à " . $recipient->findvalue('./delivered_date') . ".\n";
											}
											elsif($recipient->findvalue('./status_id') eq "2")
											{
												print " n'a pas reçu le SMS.\n";
											}
											elsif($recipient->findvalue('./status_id') eq "3")
											{
												print " est en attente de livraison par l'opérateur.\n";
											}
											elsif($recipient->findvalue('./status_id') eq "4")
											{
												print " est en cours de traitement par Envoyer SMS Pro.\n";
											}
											elsif($recipient->findvalue('./status_id') eq "5")
											{
												print " est en STOP SMS.\n";
											}
										}
									}
									else
									{
										print "Impossible de récupérer les statistiques du message :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/message/cancel';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'messageid' => '0'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Envoi annulé!\n\n";
								
										print "Le messageid : " . $xml->findvalue('/envoyersmspro/message/message_id') . "\n";
										print "Nombre de SMS recrédité : " . $xml->findvalue('/envoyersmspro/message/recredited_sms') . "\n";
										print "Nombre de SMS restants : " . $xml->findvalue('/envoyersmspro/message/sms_remaining') . "\n";
									}
									else
									{
										print "Impossible d'annuler l'envoi :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/account/getallaccounts';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Voici vos comptes :\n\n";
								
										print "-------\n";
								
										for my $account ($xml->findnodes('/envoyersmspro/accounts/account'))
										{
											print "L'accountid : " . $account->findvalue('./account_id') . "\n";
											print "Le nom du compte : " . $account->findvalue('./account_name') . "\n";
											print "Le nombre de SMS restant : " . $account->findvalue('./sms_remaining') . "\n";
											print "-------\n";
										}
									}
									else
									{
										print "Impossible de lister vos comptes :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/account/create';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'accountname' => 'Nouveau compte Perl'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Compte créé!\n\n";
								
										print "L'accountid : " . $xml->findvalue('/envoyersmspro/account/account_id') . "\n";
									}
									else
									{
										print "Impossible de créer le compte :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/account/delete';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'deleteaccountid' => '0'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Compte supprimé! Voici vos comptes :\n\n";
								
										print "-------\n";
								
										for my $account ($xml->findnodes('/envoyersmspro/accounts/account'))
										{
											print "L'accountid : " . $account->findvalue('./account_id') . "\n";
											print "Le nom du compte : " . $account->findvalue('./account_name') . "\n";
											print "Le nombre de SMS restant : " . $account->findvalue('./sms_remaining') . "\n";
											print "-------\n";
										}
									}
									else
									{
										print "Impossible de supprimer le compte :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/account/transfer';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'debitaccountid' => '0','creditaccountid' => '0','sms' => '1'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "SMS transférés!\n\n";
								
										print "----Compte débité----\n";
								
										for my $account ($xml->findnodes('/envoyersmspro/accounts/debitaccount'))
										{
											print "L'accountid : " . $account->findvalue('./account_id') . "\n";
											print "Le nom du compte : " . $account->findvalue('./account_name') . "\n";
											print "Le nombre de SMS restant : " . $account->findvalue('./sms_remaining') . "\n";
										}
								
										print "\n----Compte crédité----\n";
								
										for my $account ($xml->findnodes('/envoyersmspro/accounts/creditaccount'))
										{
											print "L'accountid : " . $account->findvalue('./account_id') . "\n";
											print "Le nom du compte : " . $account->findvalue('./account_name') . "\n";
											print "Le nombre de SMS restant : " . $account->findvalue('./sms_remaining') . "\n";
										}
									}
									else
									{
										print "Impossible de transférer les SMS :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/stopsms/activate';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'phonenumber' => '33600000000'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Le " . $xml->findvalue('/envoyersmspro/stopsms/phone_number') . " est désormais en STOP SMS.\n";
									}
									else
									{
										print "Impossible d'activer le STOP SMS :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			
				      			#!/usr/bin/perl
								use warnings;
								use strict;
								use LWP::UserAgent;
								use HTTP::Cookies;
								use HTTP::Request::Common qw(POST);
								use XML::LibXML;
								
								my $ENVOYERSMSPRO_PROTOCOL = 'https';
								
								my $ENVOYERSMSPRO_HOST = 'www.envoyersmspro.com';
								
								my $ENVOYERSMSPRO_URL = '/api/stopsms/deactivate';
								
								my $ENVOYERSMSPRO_LOGIN = '';
								my $ENVOYERSMSPRO_PASSWORD = '';
								
								my $userAgent = new LWP::UserAgent;
								$userAgent->protocols_allowed( [ $ENVOYERSMSPRO_PROTOCOL] );
								
								my $request = POST($ENVOYERSMSPRO_PROTOCOL . '://' . $ENVOYERSMSPRO_HOST . $ENVOYERSMSPRO_URL,
								[ 'phonenumber' => '33600000000'],
								Content_Type => 'multipart/form-data');
								
								$request->authorization_basic($ENVOYERSMSPRO_LOGIN, $ENVOYERSMSPRO_PASSWORD);
								
								my $response = $userAgent->request($request);
								
								
								if ( $response->is_success ) {
								
									my $parser = XML::LibXML->new();
									my $xml = $parser->parse_string($response->content());
								
									if($xml->findvalue('/envoyersmspro/status') eq "success")
									{
										print "Le " . $xml->findvalue('/envoyersmspro/stopsms/phone_number') . " n'est plus en STOP SMS.\n";
									}
									else
									{
										print "Impossible de désactiver le STOP SMS :\n\n";
										for my $account ($xml->findnodes('/envoyersmspro/error'))
										{
											print "La requête : " . $account->findvalue('./request') . "\n";
											print "L'errorid : " . $account->findvalue('./error_id') . "\n";
											print "Le message d'erreur : " . $account->findvalue('./error_message') . "\n";
											print "-------\n";
										}
									}
								}
								else
								{
									print $response->status_line;
								}				      			

Nos autres langages de programmation

Vos packs SMS

section


Envoi de sms groupé
ou à l'unité


  • Sans engagement
  • Sans date limite d'utilisation
  • Sans frais supplémentaires
  • Des prix dégressifs


500 SMS

7,4 cts/unité
37 € HT
Achetez

1000 SMS

7 cts/unité
70 € HT
Achetez

5 000 SMS

6,7 cts/unité
335 € HT
Achetez

10 000 SMS

6,5 cts/unité
650 € HT
Achetez

50 000 SMS

6,2 cts/unité
3 100 € HT
Achetez

100 000 SMS

6 cts/unité
6 000 € HT
Achetez


A la carte

SMS = - € HT soit -cts/unité