PHP Developers!

Start by checking out the possible solutions on how to add SMS functionality to your website. Read the quick overview:

php sms example Beginners: How to send/receive SMS with PHP...

Send SMS using HTTP:

With PHP you can easily submit SMS messages using HTTP requests:

Send SMS (PHP + HTML form)
Send SMS (URL examples)

The Ozeki NG SMS Gateway can send incoming messages to your PHP website through HTTP GET and POST requests:

Receive SMS using PHP and HTTP

SMS from MySQL:

If your website has a MySQL database, check out the following information:

Send SMS from MySQL

SMS Gateway software
Ozeki brings you outstanding
SMS Gateway technology. Use our SMS Server products on Windows,Linux, or Android

Developers can use our C# SMS API to send SMS from C#.Net. The C# SMS API comes with full source code

The ozeki PHP SMS gateway software can be used to send SMS from PHP and to receive SMS usig PHP on your website

SMPP SMS Gateway
SMS service providers use our SMPP gateway solution, that offers a high performance SMPP server and SMPP client gateway with amazing routing capabilities

PHP SMS API for PHP Developers - How to add SMS functionality to a website

Download source code (tgz format): php-sms-api-php-sms-example.tgz

Download source code (zip format):

This guide gives you step by step instructions on how to add SMS functionality to a PHP website using an SQL to SMS gateway configuration. The example explains all the steps necessary and gives links to sections detailing each step.

Phase I - setting up the SQL to SMS gateway configuration

Phase one gives you the configuration steps that are necessary to configure an SQL to SMS gateway architecture.

Step 1.) The first step is to attach a GSM modem to the SMS gateway computer with a datacable. For a GSM modem it is best to use one of the supported models, for example a Wavecom Fastrack MB1306B is a good option. Other models can be found in the Recommended GSM modems for SMS sending guide.

Step 2.) Step two is to install Ozeki NG on the SMS gateway computer, following the instructions provided in the quick startup guide. The instructions in this guide will help setup the GSM modem and to send your first SMS messages from the graphical user interface of the SMS gateway.

Step 3.) Then you should setup a MySQL database on the webserver, and you should create two database tables. One would be used for sending SMS messages and another would be used to receive SMS messages. This MySQL SMS Gateway Configuration / database table layout section contains the MySQL create table script you can use to create the database.

Step 4.) The next step is to install MyODBC v5.1 on the sms gateway computer. MyODBC will make it possible for the SMS gateway to connect to your MySQL database server. MyODBC is a database connectivity driver.

Step 5.) The final, most important step is to configure the SQL to SMS gateway configuration for MySQL in Ozeki NG. These pages giveg you up to date instructions on this topic:

Phase II - The PHP script

Once the SMS gateway is in place, your PHP website can send SMS messages by simply placing records into a mysql database table called ozekimessageout. For example you can create an HTML form, that the visitors of the website will fill in. When the form is submitted you can create record in the ozekimessagout database table using an SQL INSERT statement. See example:

Example 1: How to send an SMS message


<H1> Send an SMS </H1>

$phonenum = $_GET['phonenum'];
$messagetext = $_GET['messagetext'];

if ($phonenum<>'') {

  $conn = mysql_connect("localhost", 'ozeki', 'abc123');
  if (!$conn) {
    die('Could not connect to database ' . mysql_error());

  $sql = "INSERT INTO ozekimessageout (receiver,msg,status) ".
         "VALUES ('$phonenum','$messagetext','send')";

  echo "The message has been submitted for sending <br><br>";

<FORM action=send.php METHOD=GET>
  Mobil phone number:
  <INPUT TYPE="TEXT" SIZE="16" NAME="phonenum" VALUE="+44777888999">
  <TEXTAREA NAME="messagetext" ROWS=5 COLS=40>Hello world</TEXTAREA>


To receive SMS messages all you have to do is select the records from the ozekimessagin database table. This can be done by issuing a simple SQL SELECT statement. Take a look at the following example.

Example 2: How to receive an SMS message


<H1>List incoming messages</H1>

  $conn = mysql_connect("localhost", 'ozeki', 'abc123');
  $sql = "SELECT sender,senttime,msg FROM ozekimessagein ORDER BY senttime desc";
  $res = mysql_query($sql);
  $cn = mysql_num_rows($res);

  for ($x=0;$x<$cn;$x++) {
     list ($sender,$senttime,$msg) = mysql_fetch_row($res);
     echo "<li>$senttime, <b>$sender</b>, $msg";



More information