SMS Message Parsing

Discussion in 'PHP' started by gigamike, Dec 13, 2006.

  1. #1
    Hi Guys,

    i hope you can help me or give suggestion regarding in parsing SMS message. My Goal is to identify the Account, Mobile Pin and Request. As of the moment my format is something like this:

    MOBILEPIN ACCOUNTNO BALANCE

    i was able to provide the request of the user coz i can parse it using $piece=explode(" ", $message);

    where:
    $piece[0]=MOBILEPIN;
    $piece[1]=ACCOUNTNO;
    $piece[2]=BALANCE;

    Now my problem is there is a lot of REQUEST type and what might happen is that i might having diffficult to parse the SMS messgae. What your suggestion here, like for exampl

    [MOBILEPIN] [ACCOUNTNO] [BALANCE] -- i used square brackets so in case the [BALANCE] might be [CHANGEPIN 1111 2222]

    see what i mean, do we have standard SMS message format ?

    Thanks,

    Mike
     
    gigamike, Dec 13, 2006 IP
  2. cellularnews

    cellularnews Peon

    Messages:
    246
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #2
    SMS is a standard - otherwise it wouldn't work.

    However, once you leave the network operator enviroment, it is down to the API you have with the agregator as to how that message is then sent to you.

    Most will split out the originating CLI from the short code keyword and the subsequent message.

    Maybe if you explained what sort of information feed you are getting from the SMS suppliers, it might be easier for people to assist?
     
    cellularnews, Dec 13, 2006 IP
  3. gigamike

    gigamike Active Member

    Messages:
    165
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #3
    Hi,

    Thanks for the response. Actually im using clickatel and it works fine. I was able to get the

    From
    To
    Message

    Now my problem i the best format for the message coz it might happen when i parsed the message. Here is the idea that came up to my mind.


    To request the account balance
    Format: username mobilepin BALANCE account

    To request a new PIN
    Format: username mobilepin CHANGEPIN tanfrom tanto

    Transfer between accounts
    Format: username mobilepin TRANSFER accountfrom accountto amttotrnsfer

    Transfer to other users
    Format: username mobilepin TRANSFER accountfrom accountto amttotrnsfer

    Wire transfer
    Format: username mobilepin TRANSFER accountfrom accountto amttotrnsfer

    Request callback from the bank
    Format: username mobilepin CALLBANK

    Where
    UPPECASE Text is Constant so I can identify the request for parsing.
    Lowercase test are values entered by user.

    I try to format in that way so it’s much easy to parse and easy to remember by the user. What do you think guys?


    Thanks,

    Mike


     
    gigamike, Dec 13, 2006 IP