I am trying to build an application that retrieves continuous streams of xml data which keeps on changing every second, then decode it and it insert it into a mysql database. So this script probably has to be executing on the server without any gui. But from the client side(from within the browser) the user should be able to start or stop the dumping process.
That is the script must be basically performing this.
while($dump == true)
{
$fetchxml = "http://agent.getstream.org/sample?from=$seq";
$seq = $fetchxml["nextsequence"];
$somedata = $fetchxml["sumdata"];
mysqlinsert_db;
}
so that from the browser if i click a button in the server side i should be able to recieve it andchange $dump to true or false depending upon wether start or stop is pressed.
Is this possible? technology no constraint. infact i would be glad if some one can inform me what tech i should use in the backend for a requirement like this as frontend would obviously be in javascript.
You want a process on the server to halt and restart from a different process.
One way to tell the continuous process to halt is using a lock file.
The other process just throws away
continue.tmpto stop the processing and creates it to resume.A better alternative would be to exit the loop when the file is thrown away and restart the process using whatever method your server has for that – but how to do that really depends on the server used. But then by recreating the lock file in the restart you know instantly that it has started or not.