/    Sign up×
Community /Pin to ProfileBookmark

Updating a webpage using a loop

Is it possible to constantly keep updating a webpage using an external .txt file and a loop or updating a textbox using a loop?

basically creating a real time chat using PHP pulling data from an external text file.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@crh3675Apr 16.2004 — Sure, set a timer to keep refreshing an IFRAME in a webpage every 5 seconds:

Your IFRAME page
<i>
</i>
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="refresh" content="5;url=thissamepage.php"/&gt;

&lt;title&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@NevermoreApr 16.2004 — It is possible to keep a PHP script running and output data in real time, with no refresh delay and, in fact, no pag refresh at all. However, not all servers support it; I have found that version 4.1 and 4.2 of PHP seem to like this but 4.3 doesn't, but you'll have to try it to find out. To check and see if you can use this technique, upload this code to your web server and access it:

[code=php]
<?php


$n=0;
for($z=0;$z<100;$z++){echo("<!-- comment -->
");}
flush();
while ($n < 10) {
echo date('h:i:s') . "<br />";
flush();
sleep(1);
$n++;
}

?>





[/code]


You should see the time displayed 10 times, with a 1 second display between each one appearing. If you do, this technique will work for you, if you see them all appear at the same time after 10 seconds then it won't.

Hope that helps.
×

Success!

Help @burozoption spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...