PHP code example of zelenin / smsru

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

    

zelenin / smsru example snippets


$client = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\ApiIdAuth($apiId), new \Zelenin\SmsRu\Client\Client());

$client = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\LoginPasswordSecureAuth($login, $password, $apiId), new \Zelenin\SmsRu\Client\Client());

$client = new \Zelenin\SmsRu\Api(new \Zelenin\SmsRu\Auth\LoginPasswordAuth($login, $password), new \Zelenin\SmsRu\Client\Client());

$sms1 = new \Zelenin\SmsRu\Entity\Sms($phone1, $text1);
$sms1->translit = 1;
$sms2 = new \Zelenin\SmsRu\Entity\Sms($phone2, $text2);

$client->smsSend($sms1);
$client->smsSend($sms2);

$client->smsSend(new \Zelenin\SmsRu\Entity\SmsPool([$sms1, $sms2]));

$send = $client->smsSend($sms);
$smsId = $send->ids[0];
$client->smsStatus($smsId);

$client->smsCost(new \Zelenin\SmsRu\Entity\Sms($phone, $text));

$client->myBalance();

$client->myLimit();

$client->mySenders();

$client->authCheck();

$client->stoplistAdd($phone, $text);

$client->stoplistDel($phone);

$client->stoplistGet();

php composer.phar