PHP code example of shxfee / dhiraagu-sms

1. Go to this page and download the library: Download shxfee/dhiraagu-sms library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

shxfee / dhiraagu-sms example snippets


// Send an SMS using Dhiraagu Bulk SMS Gateway and PHP

$username = "XXXXXXX"; // The username that you received from Dhiraagu (usually same as your SMS sender name)
$password = "YYYYYY"; // Your Dhiraagu Bulk SMS Gateway password
$url = 'https://bulksms.dhiraagu.com.mv/partners/xmlMessage.jsp'; // The Dhiraagu API endpoint. Leave blank to use the default URL. 

$client = new \Dash8x\DhiraaguSms\DhiraaguSms($username, $password, $url);
$message = $client->send(
  '+9607777777', // Text this number, use an array to send to multiple numbers
  'Hello World!' // Your message
);

print $message->message_id;

// Check the delivery status of an SMS using Dhiraagu Bulk SMS Gateway and PHP

$username = "XXXXXXX"; // The username that you received from Dhiraagu (usually same as your SMS sender name)
$password = "YYYYYY"; // Your Dhiraagu Bulk SMS Gateway password

$client = new \Dash8x\DhiraaguSms\DhiraaguSms($username, $password);
$message = $client->send(
  '+9607777777', // Text this number, use an array to send to multiple numbers
  'Hello World!' // Your message
);

$delivery = $client->delivery(
  $message->message_id, // Message id
  $message->message_key // Message key
);

print $delivery->message_status_desc;

// Check the status for a particular recipient
$device = $delivery->getDevice('9607777777'); // Omit the + of the country code
print $device->status_desc;