PHP code example of tcgunel / asistbt-sms

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

    

tcgunel / asistbt-sms example snippets


try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
        'originator' => 'ORIGINATOR',
    ]);

    $response = $asistBtSms->smsProxy()
        ->addReceiver(['905554443322'])
        ->setMessage(['Message1 text'])
        //->setSendDate('150323001020') // ddMMyyHHmmss
        // For bulk messages parameter is in minutes. Max 3360.
        // For OTP messages parameter is in seconds. Max 300.
        //->setValidityPeriod(60)
        //->setIsCheckBlackList(true)
        ->sendSms();

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getCredit();

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getOriginator();

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->abortSms((int)$packet_id); // $packet_id returns from sendSms.

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getStatusByPacketId((int)$packet_id); // $packet_id returns from sendSms.

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->smsProxy()->getStatusByMessageId([1,2,3]); // Message_id returns from sendSms.

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms->contactService()->getContact((int)5554443322);

} catch (AsistException $e) {
        
    $e->getMessage();

}

try {
    
    $asistBtSms = new \Tcgunel\AsistbtSms\AsistBtSms([
        'user_code'  => (int)0000,
        'username'   => 'username',
        'password'   => 'password',
        'account_id' => (int)0000,
    ]);

    $response = $asistBtSms
        ->contactService()
        ->addContact(
            'Ad',
            'Soyad',
            (int)5554443322,
            'GROUPID',
            false, // isBlackList
        );

} catch (AsistException $e) {
        
    $e->getMessage();

}