Alfred
-
Posts
3 -
Joined
-
Last visited
Never
Posts posted by Alfred
-
-
@ micah1701:
Does this really work? So the script would sleep for 20 seconds but would I still be able to us all buttons while the script is in sleep mode? How about this timer solution is this feasible at all?
@doni49:
There would never be more than one client logged on, but you are right it's a risk. Maybe I somehow could inhibit further page access while someone is already logged on...
-
Hey,
I'm not that familiar with PHP so maybe what I'm asking for is not even possible. I plan to establish a webserver that is connected to a RS232 device. I don't have any problems accessing the RS232 interface with a PHP-script, it's all working fine.
Now I want the incoming data from the device being display on the servers webpage almost in realtime. When I say almost I mean that the client who is logged on to the website should be able to define the update rate of the incoming data.
So here comes the problem, I need something like the java script setinterval() function that is working on the server-side and repeats the data request to the device in an infinite loop with the given time interval.
I don't want to refresh the whole page as I will have to update about 20 sets of data within seconds!
I found this code:
http://phpclasses.chimit.nl/package/5544-PHP-Call-a-function-after-a-period-of-time.html
it looks pretty promissing but I just can't make it working...
As I said I'm a PHP-noob so I just put the code below on the start of my own code and provided the Timer.class.php file in my project folder. Could anyone explain how I could make the test function repeating endlessly on a 1sec basis using this code so I would get a screen full of "called"? So far I only get two "called" :-)
Thanks!
declare(ticks=100); function test () { print "<br>called"; } require_once 'Timers.class.php'; setTimeout('test', 110000000); setInterval('test', 10000000);
[attachment deleted by admin]
PHP Repeating Interval Function
in PHP Coding Help
Posted
well... I kind of solved the problem. I created an iframe on an external php page that refreshes every X seconds without refreshing the whole main page... this is not perfect but a, acceptable workaround
this goes into main php file:
this goes into the external php file: