I am working on bulk sms application where I need to connect to the GSM modem to send and receive sms. As a part of the script I am using dio_open function to connect to COM port to send AT commands. But dio_open function throws warning and it fails to open com port.
Warning: dio_open() [<a href='function.dio-open'>function.dio-open</a>]: cannot open file COM24: with flags 0 and permissions 0: Invalid argument in C:\wamp\www\serial_port\exec.php on line 8
I am using PHP 5.3 with wamp installed on windows system. Below I mentioned PHP code I am using.
<?php
$output = array();
exec('mode COM24: baud=230400 data=8 stop=1 parity=n',$output);
// execute 'help mode' in command line of Windows for help
print_r($output);
$fd = dio_open('COM24:', O_RDONLY);
if(!$fd)
{
echo "Connection not working";
}
else
{
echo "Connection working";
}
?>
I think exec commands working fine as its returning output in array.
Array ( [0] => [1] => Status for device COM24: [2] => ------------------------ [3] => Baud: 230400 [4] => Parity: None [5] => Data Bits: 8 [6] => Stop Bits: 1 [7] => Timeout: OFF [8] => XON/XOFF: OFF [9] => CTS handshaking: OFF [10] => DSR handshaking: OFF [11] => DSR sensitivity: OFF [12] => DTR circuit: ON [13] => RTS circuit: ON [14] => )
But not sure why dio_open is giving warning and why it fails to open com port. I googled for this issue but didn't find anything helpful.please advise if I am missing anything.