Is it possible to make php code execution to break at a certain command, end the http connection, than "wait" for the client to request the page again and continue from that point but with new $_POST or $_GET content?
I don't think php offers such a thing because it's hard to make sure the second request comes from the same client.
The usage should be for controlling a simple device over the internet by a program running on the server. The device just recieves some simple commands from the server like forward
or turn_left
and responds with statements like success
or turning_failed
. But to be able to run the complex code on the server I need the ability to get feedback from the device.
And because the code is complex, I can't have simple solution like indexing the requests or something like that. The "break" command could be inside another function and/or inside a loop...
So the only solution I came up with is to make my own interpreter written in php, which would be able to break execution like required and save all states to a file and later on continue from that point.
So my question should be: Do you know such a sophisticated interpreter? (language doesn't matter - c#, lua, js, ...) It would take a long time to make my own so I want to know all options.
Btw, php generators look really nice to me but they are iterable only in foreach loop not in forsomerequest loop :D