Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Sending SMS using GSM Modem - PHP

jhefreyzz

Amateur
Advanced Member
Messages
112
Reaction score
0
Points
26
So 2 ung nag-PM sakin tungkol kung paano magsend ng SMS by using a gsm modem.

Prerequisite:
a working GSM Modem [with load]
PHP installed or Xampp

How to send an SMS using a GSM Modem

1. Check what ("COM PORT") of your modem

How to check?

  • Open your device manager
  • There will be list of devices categorize, now look into the modem part
  • Click on the modem device you've used
  • I'm not sure whether is it right, but after you click on your modem device it will prompt a small dialog which you will find the advanced tab
  • On the advanced tab you will see the COM number

2. Check if the port is accessible through CMD (command prompt)


  • Open cmd and type in "mode COM(1-5) ex. mode COM6"
  • Check if there will be a response with the details of the COM Port like the baud-rate

3. If everything is set, open your Text Editor

Those bold texts are the things you need to modify:
  • If the exec() uses COM5 then you will also use it into 2nd line of code in the fopen()
  • the 3rd bold text would be the recepient of the message
  • the 4th bold text would be the message of the text
Code:
exec("MODE [B]COM6[/B]: BAUD=9600 PARITY=N DATA=8 STOP=1", $output, $retval);
           $fp=fopen("[B]COM6[/B]","r+");
           fputs($fp, "AT+CMGF=1\r");
           fputs($fp, "AT+CMGS=\"[B]09999999999[/B]\"\r");
           fputs($fp, "[B]message here[/B]");
           fputs($fp, chr(26));
           fclose($fp);

Please note that the following method of sending SMS has its limitations:

  • The message has a limit of 160 characters [can be mitigated by using SMS PDU Module]
  • For you to send multiple recipients it will involve iterating over array of contact numbers. Meaning it will perform the same request that varies on the contact number, which necessarily need the sleep method to make sure that there will be allotted time for each request to be send
  • Cannot send multiple recipients directly

A good alternative to this one is by using a SMS Gateway Servers.
 
Back
Top Bottom