Mikegtr wrote:
Quote:
>
I need to collect and send data from a rs232 device- it is a simple
temperature controller.
I need to be able to collect actual temperature ,store the result in
database (mysql) and show it in browser in realtime (or with max 10 sec
delay).
Is there any function/script or smth that could help do that without
external software - I don't want to write a small program in e.g. C
and then collect it from database. Although it is also an option , but
i would like to do it in php.
It might have been useful to tell us what platform you are running on.
On a Linux/*nix box its certainly no problem to write a daemon in PHP (but
writing something which isolates itself from the foreground process can be
a bit tricky - but there are wrapper programs that will do that). AFAIK you
also won't be able to call the ioctls to set the serial port behaviour
directly from a stock PHP - but most *nix have tools for this (on Linux use
setserial).
Updating the stuff in real time on a browser is a bit more tricky. You could
set the page to automatically refresh every 10 seconds, or just update a
div using AJAX.
HTH
C.