deela Posted August 3, 2007 Share Posted August 3, 2007 Hi, Just need pointing i the right direction here. I need a script that can upload a selected file, then repeat the process automatically every X seconds until the user stops it. How would I go about this in PHP? Is it possible to open a stream from a local text file that php can read and respond to changes in it giving live results? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/63167-text-file-streaming/ Share on other sites More sharing options...
Daniel0 Posted August 3, 2007 Share Posted August 3, 2007 Run from CLI: <?php $config = array( 'file' => 'file.txt', 'interval' => 30, ); while(1) { $file_contents = file_get_contents($config['file']); // upload code here sleep($config['interval']); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/63167-text-file-streaming/#findComment-314838 Share on other sites More sharing options...
deela Posted August 3, 2007 Author Share Posted August 3, 2007 Thanks, Is it possible to do this without involving the CLI? I need it to be available on a webpage that the user can select the file, then the script does the rest. Quote Link to comment https://forums.phpfreaks.com/topic/63167-text-file-streaming/#findComment-314853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.