Documentation v1.0

Developers API

Integrate global SMS, 2FA, and HLR Lookups into your applications with just a few lines of code.

Send SMS: Introduction

Give your web and mobile apps the power to exchange messages of any variety, from chat to SMS. You get global reach, delivery intelligence and the highest reliability over both IP and carrier networks, all with minimal development effort.

Eazita's SMS API allows you to send text messages to users through simple RESTful APIs. You get global reach, delivery intelligence, and high reliability over both IP and carrier networks with minimal development effort.

How It Works

1. Your App Requests

Your app makes an SMS request to Eazita API

2. Eazita Processes

Eazita routes and sends the SMS to the network

3. User Receives

Your user receives your SMS message instantly

Prerequisite: You need a valid Eazita account. When you create an account, you will be provided an API_KEY. You will use this Key and your Password to authenticate.

HTTP API Endpoint

POST https://api.eazita.com/sms/json

Example Request

Copy and paste this URL into your browser (replace credentials first):

https://api.eazita.com/sms/json?api=YOUR_API_KEY&pass=YOUR_PASSWORD&from=EZSMS&to=TO_NUMBER&msg=DEMO_MESSAGE

cURL Example

curl -X "POST" "https://api.eazita.com/json" \
  -d "api=YOUR_API_KEY" \
  -d "pass=YOUR_PASSWORD" \
  -d "from=EZSMS" \
  -d "to=TO_NUMBER" \
  -d "msg=A test messaging via HTTP API."

Installation

  1. Create an Eazita account.
  2. Download the library into your hosting/server.
  3. Ensure PHP cURL is enabled on your server.

Usage

Include the library in your PHP file:

require 'EazitaMessaging.php';

Sending SMS via PHP

1. Authenticate

Initialize the class with your API Key and Password.

$ezsms = new Eazita("API_KEY","PASSWORD");

2. Build Message

Use build_send() method. You can call this multiple times to queue messages.

// Single Recipient
$ezsms->build_send([
    'to' => 'Recipient',
    'from' => 'EZSMS',
    'type' => 'text',
    'msg' => 'Test message from Eazita.'
]);

// Multiple Recipients queue
$ezsms->build_send(['to' => 'Recipient_1', 'from' => 'EZSMS', 'type' => 'text', 'msg' => 'Msg 1']);
$ezsms->build_send(['to' => 'Recipient_2', 'from' => 'EZSMS', 'type' => 'text', 'msg' => 'Msg 2']);

3. Execute & Handle Response

Call execute_send() to send all queued messages and parse the response.

$msg = $ezsms->execute_send();

if(count($msg) > 0){ 
    foreach($msg as $recipient => $resp){
        echo "Status for ".$recipient.": ".$resp['status']." (ID: ".$resp['messageid'].")";
    } 
}
Full Example Code
$ezsms = new Eazita("API_KEY","PASSWORD");

// Queue messages
$ezsms->build_send(['to' => 'Recipient_1','from' => 'EZSMS','type' => 'text','msg' => 'Hello World']);
$ezsms->build_send(['to' => 'Recipient_2','from' => 'EZSMS','type' => 'flash','msg' => 'Important Alert']);

// Send
$msg = $ezsms->execute_send();

// Output results
if(count($msg) > 0){ 
    foreach($msg as $recipient => $resp){
        echo "Message sent to $recipient. ID: " . $resp['messageid'];
    } 
}

Check Delivery Reports

Use getdelivery() with comma-separated Message IDs.

$ezsms = new Eazita("API_KEY","PASS");
$sms_log = $ezsms->getdelivery([
    'messageid' => '564581,569398'
]);
print_r($sms_log);

Check Balance

Use getbalance() to retrieve current credits.

$ezsms = new Eazita("API_KEY","PASS");
$balance = $ezsms->getbalance();
echo "Remaining: ".$balance['balance'];

2-Factor Authentication (2FA)

A cloud-based solution to verify user identities via SMS or Voice Call.

1. Send Verification Code

$start = $ezsms->start_verify([
    'number' => '923122699633',
    'brand' => 'Your-Company',
    'expire' => '600'
]);

if($start['code'] == 1){
    echo "Verification started for " . $start['location']['country'];
} else { 
    echo "Error: " . $start['error']; 
}

2. Verify Code Input

$check = $ezsms->check_verify_code([
    'number' => '923122699633',
    'code' => '1234'
]);

if($check['code'] == 1){
    echo "SUCCESS: Number Verified!";
}

Perform Number Lookup

Gather intelligence about phone numbers (Carrier, Roaming status, etc).

$ezsms = new Eazita("API_KEY","PASSWORD");

// Valid packages: basic, carrier, profile
$lookup = $ezsms->lookup([
    'package' => 'profile',
    'gsm' => '923122699633'
]);

if($lookup['code'] == 1){
    foreach($lookup['data'] as $id => $data){
        print_r($data);
    }
}