menu

Пример работы с SMS шлюзом на языке Perl



Отправка смс:

#!/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;
1
3
4
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
27
29
copy

Получения статуса отправленной смс*:

#!/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;
1
3
4
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
23
25
copy

* Информация о статусе смс будет доступна спустя несколько минут после отправки


Получение цены отправки:

#!/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;
1
3
4
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
27
29
copy

Получение баланса

#!/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;
1
3
4
6
7
9
10
11
12
13
14
15
16
17
18
20
22
copy
Другие примеры:

Пример работы с SMS шлюзом на языке Java


Пример работы с SMS шлюзом на языке C#


Пример подключения к шлюзу ePochta SMS 3.0 на PHP


Пример работы с SMS шлюзом на языке Python