- Quick start guide
- System requirements
- Installation guide
- Mobile networks
- User guide
- Developers guide
- SMS from SQL
- The best C# SMS API
- HTTP SMS API
- PHP SMS API
- Send SMS from MySQL with PHP
- SMS from Website (MySQL, PHP)
- SMS from Website (HTTP API, PHP)
- VB.NET SMS API
- Service providers
PHP SMS API
There are two basic options to choose from if you wish to send SMS messages from a website running on PHP. You can use HTTP requests to pass SMS messages directly to the SMS gateway or you can save your outgoing messages into a database and let the SMS gateway pickup the messages from there. Both options have advantages and disadvantages. This guide helps you get started by giving you information on which option is more suitable for you.
If your PHP website uses a database, such as MySQL, using this same database for sending and receiving is a good option. In this setup two database tables will be creaed one called ozekimessageout will be used for sending SMS, and another called ozekimessaging willb e used for receiving SMS.
Advantages of sending SMS from a Database
This option has several advantages. First it will be very easy for you to send a message by simply creating a database record in the ozekimessageout database table. All you have to do is simply execute an SQL INSERT command. After the message is inserted into the database table it will be picked up by Ozeki and it will be sent to the mobile network.
The biggest advantage to this option is that Ozeki will update the status of your outgoing SMS. This means that when the message is sent to the mobile network, or when a delivery report comes in after the SMS reaches the recipient handset, Ozeki will update the status field of the SMS to 'sumbitted to network' or 'delivered to handset' status. It will also set the appropriate timestamp for these events. It is very convenient to have all these information in a database table.
Incoming messgaes will also be easy to process, as they will be automatically inserted into a databaes table by Ozeki SMS Gateway. To read new messages you simply do a SELECT on the ozekimessagein table. You can freely add SQL columns to this database table to store processing related information.
Disadvantages of sending SMS from a Database
If you use a database as a method of comunication between your SMS gateway and your PHP website, you must take into account that some delays in sending SMS messages will occur. The SMS gateway checks the outgoing database table periodically (the default poll interval is 5 seconds). If a message is inserted, it will take a few seconds for it to be picked up by the SMS gateway for delivery.
Where can I find setup instructions for sending SMS from a Database?
The following page contains a video tutorial and detailed step by step instructions on how to setup SMS message on a PHP website with MySQL.
PHP gives you the option to issue HTTP requests. Since the Ozeki SMS gateway has a great http sms api, you can send SMS messages by simply forming an URL and calling it using one of the built in PHP http download methods. Using an HTTP request you can both send and SMS and you can also receive SMS messages.
Advantages of sending SMS using the HTTP SMS API
One of the biggest advantage to using the HTTP API is speed. If you send an SMS using an HTTP request, it will immediatly get to the SMS gateway without any delays. If you use a database table it will spend a few seconds in the database table. Note however, that this is only true if you only send out a few messages per minute. The HTTP request require quite a lot of resources in both network bandwidth and processing power. This means if you send a messages in bulk it is not a good choice. If you send a single SMS it will get there a few seconds faster. If you wish to send more than 10 messages, it is much better to use a database for transfer, since these messages can be picked up by the SMS gateway with a single query. If you send out several hundreds, thousands of hundreds of thousands the database option is the only valid choice.
Disadvantages of sending SMS using the HTTP SMS API
The biggest disadvantage of using the HTTP API is that you must be sure that the HTTP SMS service is available when you send your SMS. If you send an SMS at a moment when the SMS gateway is rebooted or when there is a temporary network failure, you request will not work. Your SMS can be lost. This issue does not affect the SQL to SMS solution.
Another disadvantage is the extra work required in keeping track of sent messages and delivered to network or delivered to handset reports. This is hard because these events happen later. The messages is delivered to the network a few seconds after you issue the HTTP request for submission, and it can take significantly longer for the SMS to reach the recipient handset (think of the recipient handset being switched off temporarily). The Ozeki HTTP api can be asked to notfiy your PHP script about these events, but it is more work to write the code to handle these events.
Where can I find setup instructions for sending SMS using HTTP?
The following page contains a video tutorial and detailed step by step instructions on how to setup SMS message on a PHP website with HTTP requests.