If there is no need to store the data for later use in the file you might do better to use a socket or named pipe. Your application can write to the one end of the pipe and the php script can read from the other end when data is available. In fact, the php script will block while reading the pipe/socket until data is available so there is no need to busy loop until that point.
L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
Your code is editing data in memory, not on disk so in order for others to see the changes the data must be written to disk, and re-loaded by whomever needs it.
Windows: CreateNamedPipe
Linux: Pipes, FIFO, and IPC
L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124
If you are dealing with multiple machines with varying platforms you may be best just opening a network socket and communicating that way. This would serve you best if at some point you needed to support machines hosted in various locations.
L7Sqr
Practically a Master Poster
657 posts since Feb 2011
Reputation Points: 201
Solved Threads: 124