NoeReverse
Код: require("luacurl");
--сообщение
local sXML = [==[<?xml version="1.0" encoding="utf-8"?>
<request>
<operation>SENDSMS</operation>
<message start_time="AUTO" end_time="AUTO" livetime="4" rate="120" desc="SystemMessage" source="ALFANAME">
<body>message text</body>
<recipient>1234567890</recipient>
</message>
</request>]==]
local sUser = 'user'; -- логин
local sPassword = 'password'; -- пароль
local tResponse = {}; -- здесь ответ сервера
-- отправляем сообщение -------------------------------------------------------------------------------------
local oCURL = curl.new();
oCURL:setopt(curl.OPT_WRITEFUNCTION, function (param, buf) table.insert(tResponse, buf); return #buf; end);
oCURL:setopt(curl.OPT_NOPROGRESS, true);
oCURL:setopt(curl.OPT_USERPWD, sUser..":"..sPassword);
oCURL:setopt(curl.OPT_SSL_VERIFYPEER, false);
oCURL:setopt(curl.OPT_POST, true);
oCURL:setopt(curl.OPT_URL, 'http://sms-fly.com/api/api.php');
oCURL:setopt(curl.OPT_HTTPHEADER, "Content-Type: text/xml", "Accept: text/xml");
oCURL:setopt(curl.OPT_POSTFIELDS, sXML);
oCURL:perform();
oCURL:close();
-- end ------------------------------------------------------------------------------------------------------
local sResponse = table.concat(tResponse);
Dialog.Message("Response", "Сервер ответил нам: \r\n\r\n"..sResponse, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Код: require("luacurl");
--сообщение
local sXML = [==[<?xml version="1.0" encoding="utf-8"?>
<request>
<operation>SENDSMS</operation>
<message start_time="AUTO" end_time="AUTO" livetime="4" rate="120" desc="SystemMessage" source="ALFANAME">
<body>message text</body>
<recipient>1234567890</recipient>
</message>
</request>]==]
local sUser = 'user'; -- логин
local sPassword = 'password'; -- пароль
local tResponse = {}; -- здесь ответ сервера
-- отправляем сообщение -------------------------------------------------------------------------------------
local oCURL = curl.new();
oCURL:setopt(curl.OPT_WRITEFUNCTION, function (param, buf) table.insert(tResponse, buf); return #buf; end);
oCURL:setopt(curl.OPT_NOPROGRESS, true);
oCURL:setopt(curl.OPT_USERPWD, sUser..":"..sPassword);
oCURL:setopt(curl.OPT_SSL_VERIFYPEER, false);
oCURL:setopt(curl.OPT_POST, true);
oCURL:setopt(curl.OPT_URL, 'http://sms-fly.com/api/api.php');
oCURL:setopt(curl.OPT_HTTPHEADER, "Content-Type: text/xml", "Accept: text/xml");
oCURL:setopt(curl.OPT_POSTFIELDS, sXML);
oCURL:perform();
oCURL:close();
-- end ------------------------------------------------------------------------------------------------------
local sResponse = table.concat(tResponse);
Dialog.Message("Response", "Сервер ответил нам: \r\n\r\n"..sResponse, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);