I need a simple script to read the information from a serial port (ttyS0 / ttyUSB0) using PHP on Ubuntu Linux.
I have tried th following code but the code hangs and no results are returned, also tried php_serial class found on [url removed, login to view] and keep getting errors.
$myFile = "/dev/ttyUSB0";
$handle = fopen($myFile, 'rb+');
$Data = fread($handle, 15);
Information from the serial port could come at anytime so there needs to be some sort of continuous polling waiting to receive the data from serial port.
I also need to be able to set board rate, stop bits, parity etc
The information I'm expecting to receive from the comport should look something like 000118110001001
CAN ANYONE HELP ME?