PHP MySQL SMS Application PDF
PHP MySQL SMS Application PDF
Page 1 of 4
Website updated on: Wednesday, August 26, 2009
On-line manual:
Overview
Quick start
Download
Manual
How to buy
FAQ
Search
Contact Us
Contents | Search
Home > Product Manual > Developers Guide > PHP SMS API > PHP5 and MySQL
PHP Developers!
Start by checking out the
possible solutions on how to add
SMS functionality to your
website. Read the quick
overview:
Beginners: How to
send/receive SMS
with PHP...
Introduction
This article is about sending SMS using PHP through MySQL Server. It is intended for web developers with a basic knowledge of the
PHP and SQL technologies. The page contains a downloadable source code (see above), a list of aims you can achieve using the code,
a list of prerequisites, a description and depiction of the architecture and operation of the system, step-by-step instructions about how
to use the code and a detailed interpretation. It also includes a brief summary, answers to frequently asked questions, as well as links
to related information.
Prerequisites
The following table gives you a checklist on what you need to add SMS functionality to your MySQL enabled PHP website.
PHP host:
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. For a better
understanding of how it works, please look at the following diagram (Figure 1).
8/27/2009
Page 2 of 4
Step 3: Set/Change the fixed data in the sqlsmshandling_functions.php file (e.g., server name, user name, password). Picture help
Step 4: Start the Ozeki NG - SMS Gateway Server (if not running). Picture help
Step 5: Start a web browser application (IE, Firefox, etc.) and enter this: http://127.0.0.1/sqlsmshandling.php (127.0.0.1 means
that the copied example files reside on the same computer on which the browser has been opened). Picture help
Step 6: Fill in the necessary fields, and then click the "Send" button. Picture help
Step 7: Verify the message has been sent by Ozeki NG - SMS Gateway. Picture help
Inside the last table row (<tr>) you perform the sending of the message, as well as the notification of the Internet user in case of an
error.
...
<?php
if (isset($_POST["textAreaRecipient"]) && $_POST["textAreaRecipient"] == "")
{
echo "<font style=\"color: red; font-weight: bold;\">Recipient field mustn't be empty!</font>";
}
else if (isset($_POST["textAreaRecipient"]) && $_POST["textAreaRecipient"] != "")
{
try
{
connectToDatabase();
if (insertMessage ($_POST["textAreaRecipient"], "SMS:TEXT", $_POST["textAreaMessage"]))
{
echo "<font style=\"color: red; font-weight: bold;\">Insert was successful!</font>";
}
closeConnection ();
}
catch (Exception $exc)
{
echo "Error: " . $exc->getMessage();
}
}
?>
...
8/27/2009
Page 3 of 4
"<td>"
"<td>"
"<td>"
"<td>"
"<td>"
"<td>"
"<td>"
"<td>"
"<td>"
.
.
.
.
.
.
.
.
.
$row["id"] . "</td>";
$row["sender"] . "</td>";
$row["receiver"] . "</td>";
$row["senttime"] . "</td>";
$row["receivedtime"] . "</td>";
$row["operator"] . "</td>";
$row["status"] . "</td>";
$row["msgtype"] . "</td>";
$row["msg"] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_free_result($result);
}
catch (Exception $exc)
{
echo (mysql_error() . "<br>");
return false;
}
return true;
}
...
Summary
In the article it has been explained how you can add SMS functionality to your website by using the downloadable PHP example code.
You can freely use and modify that script. Using PHP scripts (and the Ozeki NG - SMS Gateway Server) you can create a lot of useful
services(e.g.: you can add SMS functionality to a website or a corporate Intranet, create automated SMS notifications, increase
website security by adding SMS login, etc.).
8/27/2009
Page 4 of 4
$query .= "values ('+449876543', '" . $recipient . "', '" . $messageType . "', '" . $messageText . "', 'send');";
...
Related information
Ozeki NG Installation Guide
SMS Message Types
RS232 Serial Cable and Industrial Modems
IP SMS Gateway
Supported phones and GSM devices
Message statuses in database
Database table layout
Next page: Creating Database user in Ozeki NG - SMS Gateway for MySQL Server
Source: http://www.ozekisms.com/index.php?owpn=279, Word count: 2918
Copyright 2000 - 2009 Ozeki Informatics Ltd.
All rights reserved
|
Privacy policy
|
Terms of use
Legal information
Please, address your inquiries to info@ozekisms.com
8/27/2009