PHP code example of peterls / smsru

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

    

peterls / smsru example snippets


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

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

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

$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();