PHP code example of ditsly / dits-sms-api

1. Go to this page and download the library: Download ditsly/dits-sms-api 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/ */

    

ditsly / dits-sms-api example snippets



use DitsSMS\DitsSMSAPI;


use DitsSMS\DitsSMSAPI;

$api_key = 'YWRtaW46YWRtaW4ucGFzc3dvcmQ=';

$from = 'DITS';

$destination = '21892XXXXXXX';

$destination = '21892XXXXXXX,21891XXXXXXX,21892XXXXXXX,21892XXXXXXX';

$url = 'https://sms.dits.ly/sms/api';

$sms = 'Test Message From DITS SMS';

$unicode = '1'; //For Unicode message

$voice = '1'; //For voice message

$schedule_date = '02/17/2021 10:20 AM'; //Date like this format: m/d/Y h:i A

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms
);

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms,
    'unicode' => $unicode,
);

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms,
    'voice' => $voice,
);

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms, //optional
    'mms' => $mms,
    'media_url' => $media_url,
);

$sms_body = array(
    'api_key' => $api_key,
    'to' => $destination,
    'from' => $from,
    'sms' => $sms,
    'schedule' => $schedule_date,
);

$client = new DitsSMSAPI();

$response = $client->send_sms($sms_body, $url);

$get_inbox=$client->get_inbox($api_key,$url);

$get_balance=$client->check_balance($api_key,$url);