LAEinc. Creations Posted December 11, 2009 Share Posted December 11, 2009 alright, I am trying to work on something for my site, but I am very in-experianced with ajax. I bet what I am trying to do is simple, but I haven't had any luck with it this far I need a php/ajax file, that can constantly check a "update.txt" file, and as the .txt file changes on the server, it would automatically display the new contents of the text file on the webpage, without a required refresh. Id like to have it as real-time as possible, but without overloading any servers. Its not a chat box im wanting, its more of a real-time pagelog is what im looking for. All I really need is to be able to display the contents of a .txt file, as the .txt file changes in real time. Any Help Guys? Thank you sooo much in advanced ^^ Link to comment https://forums.phpfreaks.com/topic/184726-how-to-display-contents-of-a-txt-file-live/ Share on other sites More sharing options...
.josh Posted December 11, 2009 Share Posted December 11, 2009 a million ajax tuts out there. Just c/p the ajax code onto your page, make the call to the php script. php script would be something like this: <?php echo file_get_contents('textfile.txt'); ?> use javascript's settimeout() to call the ajax function every x seconds. Link to comment https://forums.phpfreaks.com/topic/184726-how-to-display-contents-of-a-txt-file-live/#findComment-975186 Share on other sites More sharing options...
LAEinc. Creations Posted December 11, 2009 Author Share Posted December 11, 2009 a million ajax tuts out there. Just c/p the ajax code onto your page, make the call to the php script. php script would be something like this: <?php echo file_get_contents('textfile.txt'); ?> use javascript's settimeout() to call the ajax function every x seconds. I know 0 javascript and ajax, I am decent in PHP as of now though. Thank you for your fast reply, too Link to comment https://forums.phpfreaks.com/topic/184726-how-to-display-contents-of-a-txt-file-live/#findComment-975187 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.