obtain data from COM port- RS232 port -SERIAL port

Hi I want to read data from a COM port - SERIAL - RS232. I thought externally with javascript or jquery to tell me not to but it is with PHP. There is a library in Phalcon Php that allows me to do this or need to find an external library



1.7k

PHP don't have access to hardware. Maybe something could be done with Zephir and make extension for PHP. Or writing extension in plain C

Your best shot is to run some daemonized program on that machine where you need to access serial port data, and then to read it from your web app via web service (json).

So you need intermediate (helper) with direct access to port data.

For instance, I'm reading APC UPS data that way from /dev/ttyS0. PHP issues system call to read and parse data from it, and then presents json formatted data to the external apps (consumers).



34.0k

Thank you very much I'll try. Or try to read from php and upload the form with Json. Very Thanks

Your best shot is to run some daemonized program on that machine where you need to access serial port data, and then to read it from your web app via web service (json).

So you need intermediate (helper) with direct access to port data.

For instance, I'm reading APC UPS data that way from /dev/ttyS0. PHP issues system call to read and parse data from it, and then presents json formatted data to the external apps (consumers).