I am trying to connect weighting machine with PHP.
I have tested with hyperterminal it is working fine.
But when I use PHP code with fopen
or dio_open
it is executed but when fgets
or dio_read
is called, it hangs and does not display anything.
Fopen Example
exec('mode com2: BAUD=2400 PARITY=N data=8 stop=1 xon=on');
$fp = fopen("COM2:", "r");
if (!$fp) {
echo "Uh-oh. Port not opened.";
} else {
echo fgets($fp);
fclose($fp);
}
DIO Example
exec('mode COM2: baud=2400 data=8 stop=1 parity=n xon=off to=on');
$fd = dio_open('COM2:', O_RDONLY | O_NONBLOCK, 0644);
echo dio_read($fd, 256);
I'm unable with my tries of both ways to gather any useful output.
Do I require inpout32.dll
file to connect?
And what is role of php_iol.dll
, this file I also required?