I'm using a device like this: https://www.google.com/search?q=GPRS+Modem&sxsrf=ACYBGNSaamI0HqEjZrM-ew59nRYv5lctEQ:1580550102344&source=lnms&tbm=isch&sa=X&ved=2ahUKEwjt8Jj7h7DnAhWwUN4KHebwDy0Q_AUoAXoECA0QAw&biw=1536&bih=754
I want to send an SMS message using Phpserial class, I've already searched and followed some instructions on how to implement it. To make sure, I've downloaded an AT Tester to try sending message from my phone to my device and it was successful.
Now I want to implement it in PHP and I tried using Phpserial class. I am using windows OS and when I tried it, it returns no error but I didn't received any message. I tried to check console and network, it has no response and it returns no error i think?
Here is the code:
<?php
require('PhpSerial.php');
$num_send = $_POST['number'];
$txt = $_POST['txt_msg'];
$serial = new PhpSerial;
if($serial->deviceSet("COM4")){
$serial->confBaudRate(9600);
$serial->confParity("none");
$serial->confCharacterLength(8);
$serial->confStopBits(1);
$serial->confFlowControl("none");
if($serial->deviceOpen()){
$serial->sendMessage("AT+CMGF=1\n\r");
$serial->sendMessage("AT+cmgs=\"".$num_send."\"\n\r");
$serial->sendMessage(" ".$txt." \n\r");
$serial->sendMessage(chr(26));
//wait for modem to send message
sleep(7);
$read=$serial->readPort();
$serial->deviceClose();
echo "Success";
}
}
?>
The code above has no errors but I didn't received any message. Why ?