In this tutorial, I will teach how to send SMS using textlocal API. Here I am using PHP to send SMS easily and simple to send SMS.

Follow few steps:

  1. Create account on Textlocal as free and buy SMS Credits
  2. If you are indian then you need to verify your DLT. It is not required for other countries
  3. Click to Help-> All Documentation, You will see send SMS via PHP link & get the example of sending SMS see the screenshot below

You will get like this of code you can replace your username and hash in below code



// Authorisation details.
$username = "your textlocal email id";
$hash = "your hash";

// Config variables. Consult for more info.
$test = "0";

// Data for text message. This is the text message data.
$sender = "TXTLCL"; // This is who the message appears to be from.
$numbers = "910000000000"; // A single number or a comma-seperated list of numbers
$message = "This is a test message from the PHP API script.";
// 612 chars or less
// A single number or a comma-seperated list of numbers
$message = urlencode($message);
$data = "username=" . $username . "&hash=" . $hash . "&message=" . $message . "&sender=" . $sender . "&numbers=" . $numbers . "&test=" . $test;
$ch = curl_init('');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch); // This is the result from the API

May this example help you to send SMS via TextLocal API.