PHP code example of fifthsage / kct-safety-number

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

    

fifthsage / kct-safety-number example snippets


use Fifthsage\KCT\SafetyNumber;
use Fifthsage\KCT\Socket;

$packet = new SafetyNumber('company id');

$socket = new Socket('127.0.0.1', 1337);

$results = $socket->send([
  'LOGIN' => $packet->login()->getPacket(),
  'REGISTER' => $packet->register('050848400000', '01000000000')->getPacket(),
]);

echo SafetyNumber::getResultCode($results['LOGIN']).PHP_EOL;
echo SafetyNumber::getResultCode($results['REGISTER']).PHP_EOL;