问题
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