How do I make sure a file is processed before it is altered?
Posted on 2011-02-16
A remote server sends data to me (POST). I have a PHP script (receive.php) that receives the data and store it in a file. Then, a totally different script (process.php) reads that file, process its content and empty the file (this way it will prepare the file for the next write and it won't process the same data twice).
But the remote server may send data to my receive.php script while process.php script is still processing the file. How do I solve this problem?