Stream behavior in PHP
When getting a stream from an API using cURL with CURLOPT_WRITEFUNCTION I can keep the stream alive. A callback function can do things with the data as it comes in. I can't do this with fopen() and fgets() because the stream closes when it receives '' or EOF. I want to constantly check a file that gets appended unpredictably. Something like: $handle = fopen('file:///home/me/myfile', 'r'); while(1){ $line = fgets($handle); echo $line; } with the while looping through existing lines of /home/me/myfile and when it's out of lines, continue looping but not close the stream at EOF. That way if myfil
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.