PHP code example of yusufthedragon / caih-sms-php

1. Go to this page and download the library: Download yusufthedragon/caih-sms-php 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/ */

    

yusufthedragon / caih-sms-php example snippets


\YusufTheDragon\CAIH\SMS::setToken('token');

\YusufTheDragon\CAIH\SMS::setChannelKey('channelKey');
// or chain it with setToken method
\YusufTheDragon\CAIH\SMS::setToken('token')->setChannelKey('channelKey');

\YusufTheDragon\CAIH\SMS::send(array $parameters);

$sendSMS = \YusufTheDragon\CAIH\SMS::send([
    'toNumber' => '6282147218942',
    'message' => 'Test Message',
    'requestId' => time()
]);
var_dump($sendSMS);

\YusufTheDragon\CAIH\SMS::queryStatus(array $parameters);

$checkSMS = \YusufTheDragon\CAIH\SMS::queryStatus([
    'messageId' => '1329851774301548544',
    'toNumber' => '6282147218942'
]);
var_dump($checkSMS);

\YusufTheDragon\CAIH\SMS::batchSend(array $parameters);

$batchSendSMS = \YusufTheDragon\CAIH\SMS::batchSend([
    'requestId' => time(),
    'batchToNumber' => [
        '6282147218942',
        '6282147218943',
        '6282147218944'
    ],
    'batchMessage' => [
        'Test SMS 1',
        'Test SMS 2',
        'Test SMS 3'
    ]
]);
var_dump($batchSendSMS);

\YusufTheDragon\CAIH\SMS::batchQueryStatus(array $parameters);

$batchQueryStatus = \YusufTheDragon\CAIH\SMS::batchQueryStatus([
    'requestId' => '160595797880071',
    'batchToNumber' => [
        '6282147218942',
        '6282147218943',
        '6282147218944'
    ],
    'batchMessageId' => [
        '910471603446566431',
        '910471603446566432',
        '910471603446566433'
    ]
]);
var_dump($batchQueryStatus);
bash
composer