03.11.2017, 08:05
Code:
require('json')
http = require('socket.http')
resp = {}
res = http.request({
url = "http://api.speedsms.vn/index.php/user/info",
headers = { authentication = "Basic " .. (mime.b64("kuDkYXtIBidDjCRmN8z_Yt9U12Dbs8TZ:x")) },
sink = ltn12.sink.table(resp)
})
if res then
resp = table.concat(resp)
resp = json.pdecode(resp)
if resp then
log(resp.data.balance)
end
end