
Untitled
By: a guest on
Aug 12th, 2012 | syntax:
None | size: 1.17 KB | hits: 13 | expires: Never
How to build php triggerable service
run php as service where php may run without being connected to client
php execution can be triggered using http request by client
php (continuous or triggered) have full access to the resources
php can send the data from the resources to the client on response
- 15:55:00 The master script runs. SELECT worktodo FROM thingstodo returns nothing
- 15:56:00 The master script runs. SELECT worktodo FROM thingstodo returns nothing
- 15:56:17 The client runs; it is a request for data from serial port.
- 15:56:17 The request is stored in the DB and gets ID 12345 and status "WAITING"
Location: http://mylocation/script.php?check=12345
- 15:57:00 The master script gets awakened and finds there is one job in WAITING status; updates it in LOCKED status and places its own IP and PID in the proper fields, then decodes the work details, sees what needs to be done and does it.
- 15:57:33 The work is done and the row gets updated again; now STATUS=COMPLETED
- 15:57:35 Meanwhile the client gets called again, but this time it finds COMPLETED, so happily fetches the data and shows it to the customer, also deleting the row not to clutter the DB.