PHP code example of cri2net / sms-client

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

    

cri2net / sms-client example snippets




use cri2net\sms_client\Sender;
use cri2net\sms_fly\SMS_fly;

$sender = new Sender();

// один доступный аккаунт
$sms1 = new SMS_fly('380000000001', 'pass1');
$sms1->alfaname = 'Alfaname';
$sender->addInstance($sms1);

// ещё один аккаунт
$sms2 = new SMS_fly('380000000002', 'pass2');
$sms1->alfaname = 'Alfaname';
$sender->addInstance($sms2);

$to = '380940000001';
$best = $sender->getBestInstance($to);
$data = $best->sendSMS($to, 'Hello!');