This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Check the amount of mobile account!
#4
Hi,

It should be something like this inside the SMS handler:

Code:
-- incoming sms handler handler = function(sms)  alert('incoming sms: [%s] %s', tostring(sms.sender), tostring(sms.data))   --******************************************  -- PUT HERE YOUR MATCH TO GET SMS PREPAID VALUE FROM SMS MESSAGE  local amount = sms.data:match([[va (.-) SMS]])  if amount ~= nil then    amount = tonumber(amount)    -- do something with amount  end  -- END MATCH TO GET SMS PREPAID VALUE FROM SMS MESSAGE  --******************************************  -- sms from known number, call parser  if table.contains(numbers, sms.sender) then    parser(sms.data, sms.sender)  end end

Now i fetch the value from the part of text ''va 550 SMS', now the match function grabs the 550 value out of the string, after that i make it a number instead of a string and you can do whatever you want with it.

BR,

Erwin van der Zwart
Reply


Messages In This Thread
RE: Check the amount of mobile account! - by Erwin van der Zwart - 13.10.2016, 20:06

Forum Jump: