Пример работы с SMS шлюзом на языке Python
Отправка смс
Получения статуса отправленной смс
Получение цены отправки
Получение баланса
Отправка смс:
login = "" password = "" phone_sms = "380633333131" msg_id = "123456" send_sms = '''<?xml version="1.0" encoding="UTF-8"?> <SMS> <operations> <operation>SEND</operation> </operations> <authentification> <username>%s</username> <password>%s</password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID="%s">%s</number> </numbers> </SMS>''' % (login, password, phone_sms, msg_id) import urllib2, urllib senddata=[('XML',send_sms)] senddata=urllib.urlencode(senddata) path='http://api.myatompark.com/members/sms/xml.php' req=urllib2.Request(path, senddata) req.add_header("Content-type", "application/x-www-form-urlencoded") result=urllib2.urlopen(req).read() print result
Получения статуса отправленной смс*:
login = "" password = "" phone_sms = "380633333131" msg_id = "123456" get_sms_status = '''<?xml version="1.0" encoding="UTF-8"?> <SMS> <operations> <operation>GETPRICE</operation> </operations> <authentification> <username>%s</username> <password>%s</password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID="%s">%s</number> </numbers> </SMS>''' % (login, password, phone_sms, msg_id) import urllib2, urllib senddata=[('XML',get_sms_status)] senddata=urllib.urlencode(senddata) path='http://api.myatompark.com/members/sms/xml.php' req=urllib2.Request(path, senddata) req.add_header("Content-type", "application/x-www-form-urlencoded") result=urllib2.urlopen(req).read() print result
* Информация о статусе смс будет доступна спустя несколько минут после отправки
Получение цены отправки:
login = "" password = "" phone_sms = "380633333131" msg_id = "123456" get_send_price = '''<?xml version="1.0" encoding="UTF-8"?> <SMS> <operations> <operation>GETPRICE</operation> </operations> <authentification> <username>%s</username> <password>%s</password> </authentification> <message> <sender>SMS</sender> <text>Test message [UTF-8]</text> </message> <numbers> <number messageID="%s">%s</number> </numbers> </SMS>''' % (login, password, phone_sms, msg_id) import urllib2, urllib senddata=[('XML',get_send_price)] senddata=urllib.urlencode(senddata) path='http://api.myatompark.com/members/sms/xml.php' req=urllib2.Request(path, senddata) req.add_header("Content-type", "application/x-www-form-urlencoded") result=urllib2.urlopen(req).read() print result
Получение баланса
login = "" password = "" phone_sms = "380633333131" msg_id = "123456" get_balance = '''<?xml version="1.0" encoding="UTF-8"?> <SMS> <operations> <operation>BALANCE</operation> </operations> <authentification> <username>%s</username> <password>%s</password> </authentification> </SMS>''' % (login, password) import urllib2, urllib senddata=[('XML',get_balance)] senddata=urllib.urlencode(senddata) path='http://api.myatompark.com/members/sms/xml.php' req=urllib2.Request(path, senddata) req.add_header("Content-type", "application/x-www-form-urlencoded") result=urllib2.urlopen(req).read() print result
Есть вопрос?

Дарья
0 (800) 21 01 91;
+38 (093) 672-52-57
+38 (095) 446-56-21
skype:dkepochta
support@epochta.com.ua

Получи бонус при пополнении
Вход для клиентов
Новости:
- 2019-12-21
- Нові тарифи СМС розсилки по Україні
- 2019-12-19
- Порядок узгодження імені відправника СМС українськими операторами на свята. Встигніть подати заявку
- 2019-09-12
- МТС Россия вносит изменения в условия отправки СМС по фиксированному каналу
- 2019-07-26
- Обновление тарифа на отправку СМС абонентам Билайн (Россия)
- 2019-07-12
- Впровадження абонплати за використання імені відправника від МТС Росія