Bulk SMS Messaging

Mass text messaging

Enable your site administrator to launch an SMS marketing campaign using the mobile numbers of your customers who opt-in to receive such information.

Learn how to send the same text message to a list of your customers (for example, marketing or event notification) right from your web site.

What does this thing do?

This PHP sample application demonstrates how to create a web form that sends bulk SMS to the specified mobile phone numbers. In this tutorial, we will show you the HTML form that accepts a message and a list of recipient numbers, and the code that sends the message via SMS to these mobile numbers at one click and checks message delivery statuses by using Apifonica API.

Let’s get started!


  1. An Apifonica account SID and password to send SMS messages from the web.
    You can find these in your personal account.
  2. An Apifonica phone number to be the SMS sender’s number.You can rent a number from your Apifonica account.
  3. An Apache/nginx HTTP server supporting PHP version 5 or higher.

Step 1 - Get the Code

Click here to download the source (case02.php) which includes everything you need for this tutorial.

The file contains an HTTP form to be displayed to the site administrator who will run the SMS campaign. It also has the functions that send your marketing content via SMS messages to all mobile numbers specified by the administrator, and check SMS delivery statuses.

The following diagram demonstrates how the sample works.

Step 2 - Set Default Variables

In the downloaded case02.php file, specify the default parameter values:

  • Your account SID.
  • Your account password (authToken).
  • A number you have rented from this account—this number will be used as the SMS sender’s number.

It is recommended that you use an alpha name as the sender’s number. You can register an alpha name in the personal account.

// Specify Apifonica API URL
$api_url = '';
// Specify your Apifonica account SID
// Specify your Apifonica account password
$password = 'XXXXXXXXXXXX';
// Specify the message sender's number or alpha-name (this number must belong to the Apifonica account you have specified)
$from = 'XXXXXXXXXXX';

Step 3 – Upload the Updated Sample File to Your Server

The data you have specified will now be used for sending SMS messages: your Apifonica account will be charged for outgoing SMS messages sent from the web to those mobile numbers you specify in the web form.

Step 4 – Open the Web Form on Your Site and Try How It Works

Fill in the fields in the web form and click Send Your Message to send a message notification to multiple recipients via SMS from the browser.

Step 5 - Check the Message Delivery

Click the Update Delivery Status button to see that your message is sent and then delivered to your customers’ mobiles.

By visiting the Apifonica website you agree with our use of cookies. Read our Cookie Policy here.