PHP code example of intis / sdk

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

    

intis / sdk example snippets




ntis\SDK\IntisClient;

$client = new IntisClient($login, $apiKey, $apiHost);

$balance = $client->getBalance();

$amount = $balance->getAmount();     // Getting amount of money
$currency = $balance->getCurrency(); // Getting name of currency

$phoneBases = $client->getPhoneBases();

foreach($phoneBases as $oneBase){
    $oneBase->getBaseId();                               // Getting list ID
    $oneBase->getTitle();                                // Getting list name
    $oneBase->getCount();                                // Getting number of contacts in list
    $oneBase->getPages();                                // Getting number of pages in list

    $birthday = $oneBase->getBirthdayGreetingSettings(); // Getting settings of birthday greetings
    $birthday->getEnabled();                             // Getting key that is responsible for sending greetings, 0 - do not send, 1 - send
    $birthday->getDaysBefore();                          // Getting the number of days to send greetings before
    $birthday->getOriginator();                          // Getting name of sender for greeting SMS
    $birthday->getTimeToSend();                          // Getting time for sending greetings. All SMS will be sent at this time.
    $birthday->getUseLocalTime();                        // Getting variable that indicates using of local time while SMS sending.
    $birthday->getTemplate();                            // Getting text template that will be used in the messages
}

$originators = $client->getOriginators();

foreach($originators as $originator){
    $originator->getOriginator(); // Getting sender name
    $originator->getState();      // Getting sender status
}

$items = $client->getPhoneBaseItems($baseId, $page);

foreach($items as $item){
    $item->getPhone();      // Getting subscriber number
    $item->getFirstName();  // Getting subscriber first name
    $item->getMiddleName(); // Getting subscriber middle name
    $item->getLastName();   // Getting subscriber last name
    $item->getBirthDay();   // Getting subscriber birthday
    $item->getGender();     // Getting gender of subscriber
    $item->getNetwork();    // Getting operator of subscriber
    $item->getArea();       // Getting region of subscriber
    $item->getNote1();      // Getting subscriber note 1
    $item->getNote2();      // Getting subscriber note 2
}

$deliveryStatus = $client->getDeliveryStatus($messageId);

foreach($deliveryStatus as $message){
    $message->getMessageId();     // Getting message ID
    $message->getMessageStatus(); // Getting a message status
    $message->getCreatedAt();     // Getting a time of message
}

$messages = $client->sendMessage($phone, $originator, $text);

foreach($messages as $one){
    if($one->isOk()) {            // A flag of successful dispatch of a message
        $one->getPhone();         // Getting phone number
        $one->getMessageId();     // Getting message ID
        $one->getCost();          // Getting price for message
        $one->getCurrency();      // Getting name of currency
        $one->getMessagesCount(); // Getting number of message parts
    }
    else{
        $one->getPhone();         // Getting phone number
        $one->getMessage();       // Getting error message
        $one->getCode();          // Getting code error in SMS sending
    }

}

$id = $client->addToStopList($phone); // return ID in stop list

$stopList = $client->checkStopList($phone);

$stopList->getId();          // Getting ID in stop list
$stopList->getDescription(); // Getting reason of adding to stop list
$stopList->getTimeAddedAt(); // Getting time of adding to stop list

$templates = $client->getTemplates();

foreach ($templates as $template) {
    $template->getId();        // Getting template ID
    $template->getTitle();     // Getting template name
    $template->getTemplate();  // Getting text of template
    $template->getCreatedAt(); // Getting the date and time when a particular template was created
}

$templteId = $client->addTemplate($title, $text); // return ID user template

$result = $client->getDailyStatsByMonth($year, $month);

foreach($result as $one){
    $one->getDay();            // Getting day of month

    $stats = $one->getStats(); // Getting daily statistics
    foreach($stats as $i){
        $i->getState();        // Getting status of message
        $i->getCost();         // Getting prices of message
        $i->getCurrency();     // Getting name of currency
        $i->getCount();        // Getting number of message parts
    }
}

$result = $client->makeHLRRequest($phone);

foreach ($result as $hlr) {
    $hlr->getId();                    // Getting ID
    $hlr->getDestination();           // Getting recipient
    $hlr->getIMSI();                  // Getting IMSI
    $hlr->getMCC();                   // Getting MCC of subscriber
    $hlr->getMNC();                   // Getting MNC of subscriber
    $hlr->getOriginalCountryName();   // Getting the original name of the subscriber's country
    $hlr->getOriginalCountryCode();   // Getting the original code of the subscriber's country
    $hlr->getOriginalNetworkName();   // Getting the original name of the subscriber's operator
    $hlr->getOriginalNetworkPrefix(); // Getting the original prefix of the subscriber's operator
    $hlr->getPortedCountryName();     // Getting name of country if subscriber's phone number is ported
    $hlr->getPortedCountryPrefix();   // Getting prefix of country if subscriber's phone number is ported
    $hlr->getPortedNetworkName();     // Getting name of operator if subscriber's phone number is ported
    $hlr->getPortedNetworkPrefix();   // Getting prefix of operator if subscriber's phone number is ported
    $hlr->getRoamingCountryName();    // Getting name of country if the subscriber is in roaming
    $hlr->getRoamingCountryPrefix();  // Getting prefix of country if the subscriber is in roaming
    $hlr->getRoamingNetworkName();    // Getting name of operator if the subscriber is in roaming
    $hlr->getRoamingNetworkPrefix();  // Getting prefix of operator if the subscriber is in roaming
    $hlr->getStatus();                // Getting status of subscriber
    $hlr->getPricePerMessage();       // Getting price for message
    $hlr->isInRoaming();              // Determining if the subscriber is in roaming
    $hlr->isPorted();                 // Identification of ported number
}

$result = $client->getHlrStats($from, $to);

foreach($result as $hlr){
        $hlr->getId();                    // Getting ID
        $hlr->getPhone();                 // Getting phone number
        $hlr->getMessageId();             // Getting message ID
        $hlr->getTotalPrice();            // Getting final price of request
        $hlr->getDestination();           // Getting recipient
        $hlr->getIMSI();                  // Getting IMSI
        $hlr->getMCC();                   // Getting MCC of subscriber
        $hlr->getMNC();                   // Getting MNC of subscriber
        $hlr->getOriginalCountryName();   // Getting the original name of the subscriber's country
        $hlr->getOriginalCountryCode();   // Getting the original code of the subscriber's country
        $hlr->getOriginalNetworkName();   // Getting the original name of the subscriber's operator
        $hlr->getOriginalNetworkPrefix(); // Getting the original prefix of the subscriber's operator
        $hlr->getPortedCountryName();     // Getting name of country if subscriber's phone number is ported
        $hlr->getPortedCountryPrefix();   // Getting prefix of country if subscriber's phone number is ported
        $hlr->getPortedNetworkName();     // Getting name of operator if subscriber's phone number is ported
        $hlr->getPortedNetworkPrefix();   // Getting prefix of operator if subscriber's phone number is ported
        $hlr->getRoamingCountryName();    // Getting name of country if the subscriber is in roaming
        $hlr->getRoamingCountryPrefix();  // Getting prefix of country if the subscriber is in roaming
        $hlr->getRoamingNetworkName();    // Getting name of operator if the subscriber is in roaming
        $hlr->getRoamingNetworkPrefix();  // Getting prefix of operator if the subscriber is in roaming
        $hlr->getStatus();                // Getting status of subscriber
        $hlr->getPricePerMessage();       // Getting price for message
        $hlr->isInRoaming();              // Determining if the subscriber is in roaming
        $hlr->isPorted();                 // Identification of ported number
        $hlr->getRequestId();             // Getting request ID
        $hlr->getRequestTime();           // Getting time of request
    }

$network = $client->getNetworkByPhone($phone);

$network->getTitle(); // Getting operator of subscriber

$result = $client->getIncomingMessages($date);

foreach($result as $one){
    $one->getMessageId();  // Getting message ID
    $one->getOriginator(); // Getting sender name of the incoming message
    $one->getPrefix();     // Getting prefix of the incoming message
    $one->getReceivedAt(); // Getting date of the incoming message
    $one->getText();       // Getting text of the incoming message
}