GSM モデムから SMS を送信したいと考えています。このリンクを参考に実装してみました。しかし、私のモデムは応答を生成しません.任意の助け..前もって感謝.. これが私のコードスニペットです.. $gsm_send_sms = new gsm_send_sms();
$gsm_send_sms->init();
$status = $gsm_send_sms->my_send_message_function("+09524566775", "raja");
$gsm_send_sms->close();
//シリアル SMS モデム経由で SMS を送信する class gsm_send_sms {
public $port = 'COM7';
public $baud = "9600";
public $debug = true;
private $fp;
private $buffer;
//Setup COM port
public function init() {
$this->debugmsg("Setting up port: \"{$this->port} @ \"{$this->baud}\" baud");
exec("MODE {$this->port}: BAUD={$this->baud} PARITY=N DATA=8 STOP=1", $output, $retval);
if ($retval != 0) {
throw new Exception('Unable to setup COM port, check it is correct');
}
$this->debugmsg(implode("\n", $output));
$this->debugmsg("Opening port");
//Open COM port
$this->fp = fopen($this->port . ':', 'r+');
//Check port opened
if (!$this->fp) {
throw new Exception("Unable to open port \"{$this->port}\"");
}
$this->debugmsg("Port opened");
$this->debugmsg("Checking for responce from modem");
//Check modem connected
fputs($this->fp, "AT\r");
//Wait for ok
$status = $this->wait_reply("OK\r\n", 5);
if (!$status) {
throw new Exception('Did not receive responce from modem');
}