I figured this out, what I did is open device manager see the modems and check for the com port number there! Moreoever sometimes port don't open for unknown reason then I restart my system and mobile then everything works like charm
Sending SMS with AT+ Commands using fopen()
题
My gsm phone nokia 5530 is attached via usb on COM1 port. I am trying to send SMS but for some unknown reasons it is not working OS: windows 8.1
<?php
exec("MODE COM1: BAUD=9600 PARITY=N DATA=8 STOP=1", $output, $retval);
print_r($retval);
$fp=fopen("COM1","r+");
if($fp){
echo "COM1 port opened";
}
fwrite($fp,"AT+CMGF=1");
fwrite($fp,"AT+CMGS='03337954096','hi test message'");
fclose($fp);
?>
Edit: Port is opening successfully however problem is in sending AT+ commands I guess
解决方案
不隶属于 StackOverflow