menu

SMS gateway usage example for Perl



Send sms:

#!/usr/bin/perl

use LWP::UserAgent; 
my $ua = new LWP::UserAgent;

my $login = '';
my $password = '';

my $send_sms = '<?xml version="1.0" encoding="UTF-8"?>  
  <SMS> 
  <operations>  
  <operation>SEND</operation> 
  </operations> 
  <authentification>  
  <username>'.$login.'</username> 
  <password>'.$password.'</password>  
  </authentification> 
  <message> 
  <sender>SMS</sender>  
  <text>Test message [UTF-8]</text> 
  </message>  
  <numbers> 
  <number messageID="msg11">380972920000</number> 
  </numbers>  
  </SMS>';  
    
my $response = $ua->post('http://api.atompark.com/members/sms/xml.php',{ XML => $send_sms});

print $response->content; 
  

Get a status of sent sms*:

#!/usr/bin/perl

use LWP::UserAgent; 
my $ua = new LWP::UserAgent;

my $login = '';
my $password = '';

my $get_sms_status = '<?xml version="1.0" encoding="UTF-8"?>  
  <SMS> 
  <operations>  
  <operation>SEND</operation> 
  </operations> 
  <authentification>  
  <username>'.$login.'</username> 
  <password>'.$password.'</password>  
  </authentification> 
  <statistics>    
  <messageid>msg11</messageid>  
  </statistics>   
  </SMS>';  
    
my $response = $ua->post('http://api.atompark.com/members/sms/xml.php',{ XML => $get_sms_status});

print $response->content;
  

* The sms status information will be available in a few minutes


Get a price of sms:

#!/usr/bin/perl

use LWP::UserAgent; 
my $ua = new LWP::UserAgent;

my $login = '';
my $password = '';

my $get_send_price = '<?xml version="1.0" encoding="UTF-8"?>  
  <SMS> 
  <operations>  
  <operation>GETPRICE</operation> 
  </operations> 
  <authentification>  
  <username>'.$login.'</username> 
  <password>'.$password.'</password>  
  </authentification> 
  <message> 
  <sender>SMS</sender>  
  <text>Test message [UTF-8]</text> 
  </message>  
  <numbers> 
  <number messageID="msg11">380972920000</number> 
  </numbers>  
  </SMS>';  
    
my $response = $ua->post('http://api.atompark.com/members/sms/xml.php',{ XML => $get_send_price});

print $response->content; 
  

Get a current balance

#!/usr/bin/perl

use LWP::UserAgent; 
my $ua = new LWP::UserAgent;

my $login = '';
my $password = '';

my $get_balance = '<?xml version="1.0" encoding="UTF-8"?> 
  <SMS> 
  <operations>  
  <operation>BALANCE</operation>  
  </operations> 
  <authentification>  
  <username>'.$login.'</username> 
  <password>'.$password.'</password>  
  </authentification>   
  </SMS>';  
    
my $response = $ua->post('http://api.atompark.com/members/sms/xml.php',{ XML => $get_balance});

print $response->content; 
  



Other examples:

SMS gateway usage example for PHP


SMS gateway usage example for C#


SMS gateway usage example for Java


SMS gateway usage example for Python