Open com port in php

主宰稳场 提交于 2019-12-18 17:08:31

问题


I have a usb 3G modem Huawei E1550 and Windows XP. I want to send sms with this modem trhow php.

I use this function to open a modem com port:

$fp = fopen ("COM3:", "wb+");
if (!$fp) {
    echo "Not open";
} else {
    echo "Open";
}

And every time I get a error:

Warning: fopen(COM3:) [function.fopen]: failed to open stream: Invalid argument in D:\Apache\htdocs\z91.ru\audio\test.php on line 3


回答1:


You can also try removing the colon next to the COMn for this to work

exec("mode COM3 BAUD=9600 PARITY=N data=8 stop=1 xon=off");

$fp = fopen ("COM3", "w");
if (!$fp) {
   echo "Not open";
} else {
   echo "Open";
}


来源:https://stackoverflow.com/questions/5920600/open-com-port-in-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!