I'm trying to send SMS via PHP using AT commands via USB modem. I can send SMS from PHP server to specific phone numbers. But the problem is, when I'm sending some text to a phone, I'm also getting at commands that I have used to send the SMS.
server.php
$fp = fopen('COM4', 'r+');
$writtenBytes = fputs($fp, "AT\r\n");
$writtenBytes = fputs($fp, "AT+CMGF=1\r\n");
$writtenBytes = fputs($fp, "WAIT=1\r\n");
$writtenBytes = fputs($fp, "AT+CSCS=\"GSM\"\n\r");
$writtenBytes = fputs($fp, "WAIT=1\r\n");
$writtenBytes = fputs($fp, "AT+CMGS=\"+91xxxxxxxxxx\"\r\n");
$writtenBytes = fputs($fp, "sample text here\n\r");
$writtenBytes = fputs($fp, chr(26));
expected output:
sample text here
But what I'm receiving as SMS is:
AT
AT+CMGF=1
WAIT=1
AT+CSCS="GSM"
WAIT=1
AT+CMGS="+91xxxxxxxxxx"
sample text here
How can I send SMS in such a way that no AT commands are send to the phone?