Content
XML documents are sent to a certain server address (a description of XML documents, their purpose, and server addresses are given below). In doing so, the POST method is used.
The data headers to be sent must contain:
Content-type: text/xml; charset=utf-8
XML documents are encoded in UTF-8. The transmitted XML document must not contain line breaks. Line breaks within the data should be replaced with "\n".
$src = '<?xml version="1.0" encoding="utf-8"?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
</request>';
// XML-document
$href = 'https://server/script.php'; // server address
$ch = curl_init();
curl_setopt ($ch, CURLOPT_HTTPHEADER, array ('Content-type: text/xml','charset=utf-8','Expect:'));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt ($ch, CURLOPT_POST, true);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $src);
curl_setopt ($ch, CURLOPT_URL, $href);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
https://host_name/xml/
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<message type="sms">
<sender>Sender 1</sender>
<text>Message text 1</text>
<translite>1</translite>
<name_delivery>Mailing 1</name_delivery>
<abonent phone="79001234567" number_sms="1" client_id_sms="101" time_send="2020-03-31 12:34" validity_period="2020-03-31 15:34" />
<abonent phone="79001234568" number_sms="2" client_id_sms="102" time_send="2020-03-31 12:35" />
<abonent phone="79001234569" number_sms="10" client_id_sms="110" time_send="" />
</message>
<message>
<sender>Sender 2</sender>
<text>Message text 2</text>
<name_delivery>Mailing 2</name_delivery>
<abonent phone="79001234567" number_sms="11" client_id_sms="111" />
<abonent phone="79001234568" number_sms="12" client_id_sms="112" />
<abonent phone="79001234569" number_sms="20" client_id_sms="120" />
</message>
</request>
Where
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<information number_sms="1" id_sms="SMS ID in the system to check the status" parts="2">Status/error message</information>
<information number_sms="2" id_sms="SMS ID in the system to check the status" parts="2">Status/error message</information>
<information number_sms="3" id_sms="SMS ID in the system to check the status" parts="2">Status/error message</information>
</response>
Where:
1. We have run out of SMS. To resolve the problem, please contact your manager.
2. We have run out of SMS.
3. The account is blocked.
4. Specify the phone number.
5. Phone number is included in the stop list.
6. This referral is closed off to you.
7. This referral is closed off.
8. Insufficient funds to send SMS. SMS will be sent as soon as you top up your account for this direction.
9. SMS text has been rejected by the moderator.
10. No sender.
11. The sender must not exceed 15 characters for numeric numbers and 11 characters for alphanumeric numbers.
12. Phone number must be less than 15 characters.
13. No message text.
14. No link.
15. There is no such sender.
16. The sender has not passed moderation.
17. This message has already been sent.
https://host_name/xml/state.php
<?xml version="1.0" encoding="utf-8" ?>Where
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<get_state>
<id_sms>IDSMS in the system to check the status</id_sms>
<id_sms>IDSMS in the system to check the status</id_sms>
<id_sms>IDSMS in the system to check the status</id_sms>
<id_sms>IDSMS in the system to check the status</id_sms>
</get_state>
</request>
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>error text</error>
</response>
error - the error text can take the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<state id_sms="IDSMS in the system to check the status" time="2020-01-01 12:57:46" num_parts="2" price="1.15">Статус</state>
<state id_sms="IDSMS in the system to check the status" time="2020-01-01 12:57:46" num_parts="2" price="1.15">Статус</state>
<state id_sms="IDSMS in the system to check the status" time="2020-01-01 12:57:46" num_parts="2" price="1.15">Статус</state>
</response>
Where
When using this method, you need to tell the manager the address of your server, which will receive SMS statuses. The XML document will be sent by POST method.
For example, in php the XML-document will be available through the variable
$GLOBALS['HTTP_RAW_POST_DATA']
The system sends an XML document to the client-server with the following content:
<?xml version="1.0" encoding="utf-8"?>
<request>
<state id_sms="SMS ID in the system to check the status" time="2020-01-01 12:57:46">Status</state>
<state id_sms="SMS ID in the system to check the status" time="2020-01-01 12:57:46">Status</state>
</request>
In response, the client-server should return an XML document with the following content:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<id_sms>3234</id_sms>
<id_sms>3234</id_sms>
</response>
Where:
If the client-server does not transmit id_sms, the status will be considered as not received by the client. Thus 5 attempts will be made to deliver the status.
Server address:
https://host_name/xml/balance.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
</request>
Where
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<money currency="RUR">150</money>
<sms area="MTC" price="1.1" type_sms="sms" type_text="Advertising" MCC="250" MNC="1">136</sms>
<sms area="Megaphone" price="2" type_sms="sms" type_text="Service" MCC="250" MNC="2">75</sms>
</response>
Where:
The amount of SMS cannot be summarised in different directions. When sending SMS in one direction, the number of available SMS messages in all other directions is reduced in accordance with their cost.
Server address:
https://host_name/xml/originator.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<any_originator>FALSE</any_originatоr>
<list_originator>
<originator state="rejected">Sender</originator>
</list_originator>
</response>
Where
Server address:
https://host_name/xml/incoming.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<time start="2020-01-31 12:23:00" end="2020-02-31 12:23:00" />
</request>
Where
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<sms id_sms="1234" date_receive="2020-01-31 12:55:53" originator="79001234567" prefix="AKCIYA" phone="3443">SMStext</sms>
<sms id_sms="1234" date_receive="2020-01-31 12:55:53" originator="79001234568" prefix="AKCIYA" phone="3443">SMStext</sms>
</response>
Where
Server address:
https://host_name/xml/def.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<phones>
<phone>79001234567</phone>
<phone>79001234568</phone>
</phones>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<phone operator="Magaphone" region="Moscow" time_zone="3">79001234567</phone>
<phone operator="Megaphone" region="Kaliningrad" time_zone="-1">79001234568</phone>
</response>
Where:
Server address:
https://host_name/xml/list_bases.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<base id_base="1234" name_base="HeadOfficeBase" time_birth="12:48" local_time_birth="yes" day_before="1" originator_birth="fitnes" on_birth="yes">Congratulations!</base>
<base id_base="1235" name_base="MoscowOfficeBase" time_birth="12:48" local_time_birth="yes" day_before="1" originator_birth="fitnes" on_birth="yes">Congratulations!</base>
</response>
Where:
Server address:
https://host_name/xml/bases.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<bases>
<base id_base="1234" name_base="HeadOfficeBase" time_birth="12:48" local_time_birth="yes" day_before="1" originator_birth="fitnes" on_birth="yes">Congratulations!</base>
<base number_base="1" name_base="MoscowOfficeBase" time_birth="12:48" local_time_birth="yes" day_before="1" originator_birth="fitnes" on_birth="yes">Congratulations!</base>
</bases>
<delete_bases>
<base id_base="1235" />
<base id_base="1236" />
</delete_bases>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<base id_base="1234">edit</base>
<base number_base="1" id_base="1235">insert</ base>
<base number_base="2" id_base="1236">edit</ base>
<base id_base="1235">delete</ base>
<base id_base="1235">not_found</ base>
</response>
Server address:
https://host_name/xml/list_phones.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<base id_base="1234" page="1" last_update="2011-03-25 08:39:48"/>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<phones page="1" num_pages="100">
<phone phone="79001234567" region="Moscow " operator="Megaphone" name="John" surname="Doe" patronymic="Johnson" date_birth="1988-08-28" male="m" addition_1="Firstadditionalfield" addition_2="второе" addition_3="третье" addition_4="четвертое" addition_5="пятое" last_update="2011-03-25 08:39:48" />
<phone phone="79001234568" region="Moscow" operator="Megaphone" name="John" surname="Doe" patronymic="Johnson" date_birth="1988-08-28" male="m" addition_1="Firstadditionalfield" addition_2="второе" addition_3="третье" addition_4="четвертое" addition_5="пятое" last_update="2011-03-25 08:39:48" />
</phones>
</response>
Where:
Server address
https://host_name/xml/phones.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<base id_base="1234">
<phone phone="79001234567" region="Moscow " operator="Megaphone" name="John" surname="Doe" patronymic="Michael" date_birth="1988-08-28" gender="m" addition_1="Firstadditionalfield" addition_2="second" addition_3="third" addition_4="forth" addition_5="fifth" number_phone="1"/>
<phone phone="79001234568" region="Moscow " operator="Megaphone" name="John" surname="Doe" patronymic="Michael" date_birth="1988-08-28" gender="m" addition_1="Firstadditionalfield" addition_2="second" addition_3="third" addition_4="forth" addition_5="fifth" number_phone="2" />
<phone phone="79001234569" action="delete" number_phone="5"/>
<phone phone="79001234570" action="delete" number_phone="6"/>
</base>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<baseid_base="1234">
<phone phone="79001234567" number_phone="1"/>insert</phone>
<phone phone="79001234568" number_phone="2" />edit</phone>
<phone phone="79001234569" number_phone="5"/>delete</phone>
<phone phone="79001234570" number_phone="6" />not_found</phone>
</response>
Server address:
https://host_name/xml/list_stop.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" /> <password value="password" />
</security>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<phone>79001234567</phone>
<phone>79001234568</phone>
</response>
Where:
Server address:
https://host_name/xml/stop.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<add_stop>
<phone phone="79001234567" />
<phone phone="79001234568" />
</add_stop>
<delete_stop>
<phone phone="79001234569" />
<phone phone="79001234570" />
</delete_stop>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<phone phone="79001234567">delete</phone>
<phone phone="79001234568">add</phone>
<phone phone="79001234569">not_found</phone>
</response>
Server address:
https://host_name/xml/list_scheduled.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<scheduled page="1"/>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - текст ошибки может принимать следующие значения:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<phones page="1" num_pages="100">
<scheduled id_sms="1234" time_put_turn="2020-11-14 12:42:40" originator="SENDER_1" phone="79001234567" type_sms="sms" text_sms="TextSMS" count_sms="2" name_delivery="Mailingname" time_send="2011-11-14 21:00" validity_period="2011-11-17 21:00:00" />
<scheduled id_sms="1235" time_put_turn="2020-11-14 12:42:40" originator="SENDER_1" phone="79001234568" type_sms="sms" text_sms="TextSMS" count_sms="2" name_delivery="Mailingname" time_send="2011-11-14 21:00" validity_period="2011-11-17 21:00:00" />
</phones>
</response>
Where:
Server address:
https://host_name/xml/scheduled.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<delete_schedule>
<schedule id_sms="1234" />
<schedule id_sms="1235" />
</delete_schedule>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<scheduled id_sms="1234">delete</scheduled>
<scheduled id_sms="1235">not_found</scheduled>
</response>
Server address:
https://host_name/xml/check_change.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<check obgect="base" id="1"/>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<obgect time_update="2012-01-01 12:12:12" />
</response>
Where
Server address:
https://host_name/xml/time.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<time>15:34:05</time>
</response>
Where:
However, the time is calculated as the time on the server minus the time zone difference between the user and the server.
The server is located in Moscow and its server time is Moscow-based, and at the moment of the request it was 15:34:27. But the user was listed in Novosibirsk and the time zone difference (between the server and the user) was equal to +3. The following XML document will be returned to you:
<?xml version="1.0" encoding="utf-8"?>
<response>
<time>2012-12-17 18:34:27</time>
</response>
You can receive the statistics only for the last 3 months. SMS older than 3 months are moved to the archive. You can request to export statistics for SMS older than 3 months through your manager.
Server address:
https://host_name/xml/stats.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<stats date_start="2016-08-21" date_stop="2016-08-21" state="deliver" originator="SENDER_1" phone="" operator="" from_hour="00" from_minute="00" to_hour="" to_minute="" />
</request>
Where:
The response may be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<stats num_stats="100">
<stat id_sms="100123" id_state="2000123" operator="МТС" name_delivery="Office" phone="7900123****" originator="SENDER_1" time_change_state="2016-08-10 23:04:32" time="2016-08-10 23:04:18" status="deliver" status_translate="delivered" text="SMS TEXT" price="1.05" part_no="1" num_parts="2"></stat>
<stat id_sms="100124" id_state="2000124" operator="МТС" name_delivery="Office" phone="7900123****" originator="SENDER_1" time_change_state="2016-08-10 23:04:32" time="2016-08-10 23:04:18" status="deliver" text="TEXT MESSAGE FOLLOW-UP" price="1.05" part_no="2" num_parts="2"></stat>
</stats>
</response>
Where:
Server address:
https://host_name/xml/list_patterns.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<pattern id_pattern="1234" name="HeaderTemplate1">Template1</pattern>
<pattern id_pattern="1235" name="HeaderTemplate2">Template2</pattern>
</response>
Where:
Server address:
https://host_name/xml/patterns.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<patterns>
<pattern id_pattern="1234" name="HeaderTemplate1">Template1</base>
<pattern id_pattern="1235" name="HeaderTemplate2">Template2</base>
<pattern number_pattern="1" name="HeaderTemplate3">Template3</pattern>
</patterns>
<delete_patterns>
<pattern id_pattern="1236" />
<pattern id_pattern="1237" />
</delete_patterns>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<pattern id_pattern="1234">edit</pattern>
<pattern id_pattern="1235">not_edit</ pattern>
<pattern number_base="1" id_pattern="1238">insert</ pattern>
<pattern id_pattern="1236">delete</ pattern>
<pattern id_pattern="1237">not_found</ pattern>
</response>
Where:
Server address:
https://host_name/xml/list_registry_originator.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="логин" />
<password value="пароль" />
</security>
<registry_originator operator="Operator" originator="Sender name" inn="INN"></registry_originator>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<registry_originator>
<operator name="mts" title="MTS">
<originator originator="Sender 1" date_from="2017-05-20" legal_entity="IP Johnson" inn="INN" comment="Commenttext" status="approval" status_text="Approved"></originator>
<originator originator="Sender 2" date_from="2017-05-20" legal_entity="IP Johnson" inn="INN" comment="Commenttext" status="posted_for_approval" status_text="Submitted for approval"></originator>
</operator>
<operator name="mega" title="Megaphone">
<originator originator="Sender 1" date_from="2017-05-20" legal_entity="IP Johnson" inn="INN" comment="Commenttext" status="approval" status_text="Approved"></originator>
<originator originator="Sender 2" date_from="2017-05-20" legal_entity="IP Johnson" inn="INN" comment="Commenttext" status="posted_for_approval" status_text="Submitted for approval"></originator>
</operator>
</registry_originator>
</response>
Where:
Server address:
https://host_name/xml/registry_originator.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<registry_originator>
<originator originator="Sender 1" legal_entity="IP Johnson" operator="mts" inn="INN" comment="Commenttext"></originator>
<originator originator="Sender 1" legal_entity="IP Johnson" operator="tele2" inn="INN" comment="Commenttext"></originator>
<originator originator="Sender 2" legal_entity="IP Johnson" operator="mts" inn="INN"></originator>
</registry_originator>
<delete_registry_originator>
<originator originator="Sender 3"></originator>
<originator originator="Sender 4" operator="mega"></originator>
</delete_registry_originator>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<registry_originator>
<originator originator="Sender 1" operator="mts" inn="INN" status="add" error=""></originator>
<originator originator="Sender 1" operator="tele2" inn="INN" status="error" error="Error description"></originator>
<originator originator="Sender 2" operator="mts" inn="INN" status="add" error=""></originator>
</registry_originator>
<delete_registry_originator>
<originator originator="Sender 3" operator="" status="delete" error=""></originator>
<originator originator="Sender 4" operator="mega" status="not_found" error="Sender's name not found"></originator>
</delete_registry_originator>
</response>
Where:
Server address:
https://host_name/xml/get_state.php
XML-document:
<?xml version="1.0" encoding="utf-8" ?>
<request>
<security>
<login value="login" />
<password value="password" />
</security>
<get_state type="set">http://site.com/state.php</get_state>
</request>
Where:
The response can be one of the following XML documents:
<?xml version="1.0" encoding="utf-8"?>
<response>
<error>Error text</error>
</response>
error - the error text can have the following meanings:
<?xml version="1.0" encoding="utf-8" ?>
<response>
<get_state>http://site.com/state.php</get_state>
</response>
Where: