PHP code example of kield-01 / smsc-ua-sms-sender

1. Go to this page and download the library: Download kield-01/smsc-ua-sms-sender 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/ */

    

kield-01 / smsc-ua-sms-sender example snippets


    use Cake\Controller\Component\SmscUaComponent;

    /**
    * Class X
    *
    * @property SmscUaComponent $SmscUa
    **/
    class X extends AppController
    {
    
        public function initialize(){
               $this->loadComponent('SmscUa');
               
               $this->SmscUa
                   ->setLogin('__LOGIN__')
                   ->setPassword('__PASSWORD__');
                   
                /** OR **/
                
                $this->SmscUa
                    ->setArgument('login', '__LOGIN__')
                    ->setArgument('psw', '__PASSWORD__');
        }
        
    }

/** Allows You to add one number to current numbers list **/
$this->SmscUa->setNumbers('380666666666');

/** Allows You to add bulk to current numbers list **/
$this->SmscUa->setNumbers(['380666666666', '380666666667']);

/** Allows You to set message Text **/
$this->SmscUa->setMessageBody('Random text');

/** Allows You to change Response format **/
$this->SmscUa->setResponseFormat('string'); // Response as string data
$this->SmscUa->setResponseFormat('digits'); // Response as digits, separated by ','
$this->SmscUa->setResponseFormat('xml');    // Response as XML Document
$this->SmscUa->setResponseFormat('json');   // Response as JSON Object

/** Sending methods **/
$this->SmscUa->sendPlainTextSMS(); // Sending simple SMS