57ec SMS Gateway - PHP SMS API, PHP - SQL - SMS on web

                

Search the manual:

Overview Quick start Download Manual How to buy FAQ Contact Us
OZEKI NG SMS Gateway - Product Guide

Receive SMS on a Website (PHP) Contents | SearchSend SMS from Website (PHP)

Home > Product Manual > Developers Guide > PHP SMS API > PHP - SQL - SMS on web

SMS Gateway SMS Gateway Home

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


 



Contact Us!
If you wish to get further information, do not hesitate to contact us!

E-mail: info@ozekisms.com

If you have a technical question, please submit a support request on-line.


Callcenter developers
If you are working on telephone solutions, please check out the Ozeki VoIP SIP SDK.
It can be used to create:

Webphone solutions:
- Adobe Flash video phone
- Silverlight video phone
- Web to web calls
- Web to VoIP calls

Custom SIP clients:
- Silverlight SIP VoIP client
- Flash SIP VoIP client
- C# .net SIP VoIP client
- ASP .net SIP VoIP client
- Web based SIP VoIP client

Custom VoIP solutions:
- VoIP SIP softphones
- VoIP call center clients
- VoIP IVR systems
- VoIP predictive dialer systems
- VoIP auto dialer systems
- VoIP call assistant
- VoIP call recording systems
- VoIP intercom solutions

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): php_sms_api_php_sms_example.zip

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:
http://www.ozekisms.com/index.php?owpn=164 http://www.ozekisms.com/index.php?owpn=168

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

<HTML>
<BODY>

<H1> Send an SMS </H1>

<?php
$phonenum = $_GET['phonenum'];
$messagetext = $_GET['messagetext'];

if ($phonenum<>'') {

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

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

  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">
  <br>
  <TEXTAREA NAME="messagetext" ROWS=5 COLS=40>Hello world</TEXTAREA>
  <br>
  <INPUT TYPE=SUBMIT VALUE=SEND>
</FORM>

</BODY>
</HTML>

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

<HTML>
<BODY>

<H1>List incoming messages</H1>

<?php
  $conn = mysql_connect("localhost", 'ozeki', 'abc123');
  mysql_select_db('ozekisms');
  $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";
  }

  mysql_close($conn);
?>

</BODY>
</HTML>





Next page: Send SMS from Website (PHP)

Copyright © 2000 - 2013 Ozeki Informatics Ltd.
All rights reserved

Software PBX for Windows | VoIP SDK   |   Legal information   |   Privacy policy   |   Terms of use
Please, address your inquiries to info@ozekisms.com


0