playSMS auto-responder using mysql query to get results for send

I’ve need help with this requirement.

Clients send SMS to my smsgateway playSMS with this body: CONSULTA 123456 . Then on receive i want to autoreply sms to the sender number with the result of the query (that search 123456 on a local db mysql and return info like name or address )inside some php cli command. Thanks.

you can do it completely within php.
I would create an own table for incoming requests (or just a status for the sms of playsms). then perform your search regarding that request, and perform a webservice-request to playsms to send the answer. and in your new table you have to update the status of that request. it is just for storing the information if a request has been processed or not.
the job should run as often as necessary (every minute? every 5 minutes? what do sms senders expect as answer time?).

Thanx Andre , excuse my English its basic. You know that systems that you write a sms like this “VOTE 123456(id number)” and get a response like “evergreen street 123” where de data of the adress its stored on an internal mysql db and the index is the person id (123456). So the script i thing should get de id number of the body sms message (123456) --> query local mysql db—> get the result (evergreen street 123) —> compose reply sms to the sender with this data. And the response time should be as fast as the system (playsSMS) can answer.

to be honest - I don’t know how to do it with external tools from playsms directly.
But you could periodically search for new incoming sms matching your criteria and put it into another table with the relevant information (maybe trigger (if mysql supports triggers), otherwise with another scheduled job).
another job can extract from that table the information, get the required address and create via webservice an answer via playsms.

e.g.:
Job A:

  1. step: select * from playsms.tblIncomingSms where body like ‘VOTE%’; (don’t know the correct table names ad hoc)
  2. step: insert into externalTool.incoming_sms set (id=$id, …, status=0);
    Job B;
  3. step: select * from externalTool.incoming_sms where status=0 limit 1;
  4. step: <?php # search address, and create webservice for answer SMS)
  5. step: update externalTool.incoming_sms set status=1 where id=<id from 1st step)
  6. step: goto 1st step, until no entry with status 0 exists; if no new entry exists, sleep x seconds