为什么我写的代码不会发送gsm AT命令

我试图从我的Vista电脑发送短信。 我从“命令窗口”尝试AT命令并发送短信。 然后,我写了PHP代码从PHP发送短信; 它打开端口,但不发送短信。

$device = "COM14"; exec("mode $device : BAUD=9600 PARITY=n DATA=8 STOP=1"); $comport = fopen($device, "w+"); if ($comport === false){ die("Failed opening com port<br/>"); }else{ echo "Com port is open<br/>"; } $smsText="Test message"; $atcmd1 ='AT+CMGF=1 \r\n'; $atcmd2 ='AT+CMGS=\"05324370000\"\r\n' . $smsText . chr(26) .'\r\n'; fputs($comport, $atcmd1); fputs($comport, $atcmd2); fclose($comport);