I want one PHP script to wait for an event sent during the execution of another script.
User A and User B are both visitors of my website. When user A visits index.php, the page begins execution but does not return until User B also visit index.php. (The page is only displayed when both user are connected to the web server, ex.: like two guards opening a safe by turning the key at the same time.)
One way to make this happen is for index.php to pause its execution until a notification is received caused by the other user's visit to index.php.
To do this, I have looked at
- libevent; But it does not seem to allow "ID" or "strings" to be sent during signaling.
- Event_Dispatcher from pear; But it does not work "between" scripts.
- PHP shared memory functions; But does not appear to be able to wait until the memory is changed.
you are looking for daemon, there some info how to create this:
http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/