Send Sms Modem Php

  1. Html Code To Send Sms
  2. Send Sms For Free Online

Dear Friends,

Nov 25, 2014  Sending SMS Using PHP Via GSM Modem After I was able to send sms text message in Visual Basic 6 my intention to improve my skills and knowledge in programming does not stop there. My next plan is to write an application to send sms using PHP as my programming language. PHP is one of my favorite language I earned from it and it is easy to.

  • Send SMS using AT commands. Some advanced GSM modems like WaveCom and Multitech, support the SMS text mode. This mode allows you to send SMS messages using AT commands, without the need to encode the binairy PDU field of the SMS first. This is done by the GSM modem Check if your GSM phone or modem supports SMS text mode.
  • How it works. To send SMS messages from PHP applications, you need to install Ozeki NG SMS Gateway and Microsoft SQL Server on your computer. Ozeki NG - SMS Gateway will use a GSM phone/modem attached to your PC (with a phone-to-PC data cable) or an IP SMS connection to send messages. Your PHP application will insert a row into the database to send messages using the Ozeki NG program.

Am developing a sms based website. i bought the gsm modem. problem how to connect the com port through php and querying the gsm modem with AT Commands ?? Please help me out

Modem:- Visontek 82GH USB MODEM
It supports at commands.

Note:- Am sending sms and making calls through their software but how to connect the modem through gsm modem i dont know. Please help me.

Thanks in advance
Radhakrishna Rayidi
9666055540

  • 3 Contributors
  • forum2 Replies
  • 597 Views
  • 1 Day Discussion Span
  • commentLatest Postby vattana ybm

Recommended Answers

Send Sms Modem Php

As a server-side programming language, PHP isn't the right way to deal with a device like a modem. You can certainly do it by sending to a third party service or to the phone company server as an email (if they provide that service where you are). If you search …

Jump to PostGsm sms modemSend sms usb modem php

All 2 Replies

As a server-side programming language, PHP isn't the right way to deal with a device like a modem. You can certainly do it by sending to a third party service or to the phone company server as an email (if they provide that service where you are). If you search this site you will find some previous posts about doing this directly through a modem but you will probably see that it is being done using C or Java.

Join the DZone community and get the full member experience.

Join For Free I need to send/read SMS with PHP. To do that, I need a GSM modem. There are few of them if we google a little bit. GSM modems are similar than normal modems. They’ve got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That’s means we can send (and read) SMSs and create scripts to perform those operations. Normally those kind of devices uses a serial interface. So we need to connect our PC/server with a serial cable to the device. That’s a problem. Modern PCs sometimes dont’t have serial ports. Modern GSM modems have a USB port, and even we can use serial/USB converters. I don’t like to connect directly those devices to the PC/server. They must be close. Serial/USB cables cannot be very long (2 or 3 meters). I prefer to connect those devices using serial/ethernet converters. Because of that I will create a dual library. The idea is enable the operations when device is connected via serial cable and also when it’s connected thought a serial/ethernet converter.

The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface). That means our Sms class will work exactly in the same way with one interface or another.

Let’s start. First we’re going to create a Dummy Mock object, sharing the same interface than the others. The purpose of that is to test the main class (Sms.php)

And we test the code:

It works. Our Sms class sends a fake sms using Sms_Dummy

Html Code To Send Sms

Now we only need to create Sms_Serial and Sms_Http. For Sms_Serial I’ve use the great library (with a slight modifications) of Rémy Sanchez to read/write serial port in PHP (you can find it here). We can run it with a script similar than the Dummy one, thanks to dependency injection:

And finaly the Http one. As you can see the the script is the same than the Serial one. the only difference is the class passed to the constructor of the Sms class:

Serial/Ethernet converters normally have different operational modes. They allow you to create a fake serial port on your PC and work exactly in the same way than if you have your device connected with a serial cable. I don’t like this operation mode. I prefer to use the TCP server mode. With the TCP server mode I can read/write from the serial device with the standard socket functions. So if you dive into Sms_Http class you will find TCP socket’s functions.

Send Sms For Free Online

And finally I will do a brief excerpt of AT+ commands used to send /read SMSs:

AT+CPIN?r : checks if SIM has the pin code. It answers +CPIN: READY or +CPIN: SIM PIN if we need to insert the pin number
AT+CMGS=”[number]”r[text]Control-Z : to send a SMS (in php we have Control-Z with chr(26)). It returns OK or ERROR
AT+CMGF=1r: set the device to operate in SMS text mode (0=PDU mode and 1=text mode). Returns OK.
AT+CMGL=”ALL”r read all the sms stored in the device. We also can use “REC UNREAD” Instead of “ALL”.
AT+CMGD=[ID]r: Deletes a SMS from the device

You can download the source code from github here

Like This Article? Read More From DZone

Opinions expressed by DZone contributors are their own.

This entry was posted on 18.08.2019.