0

I would like to send SMS from my GSM modem. I tried to implement this using this link as reference. But my modem will not produce any response.Any help..Thanks in advance.... Here is my code snippet.. $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();

//Send SMS via serial SMS modem 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');
    }
Community
  • 1
  • 1
sheik
  • 1
  • 1
  • 2
  • 1
    Did you take the advice in the comments under that question, to start with some very simple code? First, can you establish connection with the modem? Can you unlock the SIM? Assuming all that is running OK, please post your SMS code. – user1725145 May 23 '13 at 07:23
  • Hi S List.Thaks for your reply..Here is my code snippet – sheik May 24 '13 at 14:03

0 Answers0