PHP code example of idapgroup / viber-sdk

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

    

idapgroup / viber-sdk example snippets




dapGroup\ViberSdk\Config;
use IdapGroup\ViberSdk\Client;
use IdapGroup\ViberSdk\Api;
use IdapGroup\ViberSdk\Sms;
use IdapGroup\ViberSdk\Viber;
use IdapGroup\ViberSdk\Parameter;

$sms        = new Sms();
$viber      = new Viber();
$parameter  = new Parameter();
$config     = new Config();
$client     = new Client(['login' => 'Your login', 'password' => 'Your password']);

// Instantiate an Api client.
$api        = new Api($config, $client);

$viber->setTtl(60);                                                 //   me');
$viber->setAction('https://clicked.org');

$sms->setText('Text for sms');                                      //  

$parameter->setPhoneNumber(380123456789);                           //  st name');
$parameter->setCallbackUrl('https://send-dr-here.com');
$parameter->setStartTime('2022-12-12 10:10:10');
          
          
$response = $api->sendMessage($parameter);

print_r ($response);

$response = $api->getShortDrByMessageId('769417569');

$response = $api->getShortDrByExtraId('2j4h89932kjhs');

$response = $api->getFullDrByMessageId('769417569');

$response = $api->getFullDrByExtraId('2j4h89932kjhs');