I am trying to extract contents from a txt file. This file is dynamic because data keeps appending to it everytime the loop is executed. Inside this loop rests my logic for extracting contents from file, as follows...
$length = filesize($filename);
fseek($fd,$previousLength);
$contents = fread($fd,(($length - $previousLength)));
$previousLength = $length;
i.e, I AM trying to read only the data that got appended, in the last loop ... and not the data that was previously written. EXAMPLE... A txt adds ONE everytime a loop is run.. i.e consider
114134, 144, 1443, 1433 ...
(n of these written every once in loop ) ...
If I read n values , say
114134, 144 ...
in the first loop ...
next time, I need to read only
1443, 1443 and NOT 114134, 144 ....
fread() fails miserably here ,and fseek doesn't help ( ref. my code above) ...
I DON"T KNOW WHY !! help needed asap ..
Thanks