unisabilly Posted August 15, 2012 Share Posted August 15, 2012 Good day all : I have an issue here, i try to use php to send the SMS via my 3G USB modem, as I try to send it with hyperterminal, it works perfectly with COM port number 27. as I try to fopen COM port 27 it return with the following error message : Warning: fopen(COM27:) [function.fopen]: failed to open stream: Invalid argument in C:\AppServ\www\home\test\sms\com_connect.php on line 4 but if i fopen the COM port 1 to 4, it actually connected to the COM port, which means I can only connect to COM port 1 to 4, from COM5 onward, i wont be able to connect. any idea why ? exec("mode COM27 BAUD=9600 PARITY=N data=8 stop=1 xon=off"); $fp = fopen ("COM27:", "w+"); if (!$fp) { echo "Not open"; } else { echo "opened"; fclose($fp); } P.S. I use the port monitor software to monitor the ports, when I connect to COM port 1-4 it actually receive the request, but it receive nothing when I try COM5 onward. and I'm running apache on windows. please help. and thank you in advance Link to comment https://forums.phpfreaks.com/topic/267110-serial-port-communication-issue/ Share on other sites More sharing options...
Christian F. Posted August 15, 2012 Share Posted August 15, 2012 You could try the php_serial class and see if that helps, if not the PHP-DIO library might help. If neither does, then it might be a problem caused by the virtual status of that COM port. Which will require some further investigation, and probably a call to the USB device directly (avoiding the virtual COM port). Link to comment https://forums.phpfreaks.com/topic/267110-serial-port-communication-issue/#findComment-1369606 Share on other sites More sharing options...
unisabilly Posted August 15, 2012 Author Share Posted August 15, 2012 Thank you Christian for the reply, I have no luck with php_serial_class, and PHP-DIO gave me the same result as fopen, ie only works with port 1 t0 4, I found some articles regarding to the same issues, seems like it works fine with ubuntu but not with windows. I have no idea why is there any way to work around the issue, except for changing the OS Link to comment https://forums.phpfreaks.com/topic/267110-serial-port-communication-issue/#findComment-1369695 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.