PHP code example of gavin887 / ntvspa-big-sdk

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

    

gavin887 / ntvspa-big-sdk example snippets




use Ntvspa\Big\ServiceFactory;
use Ntvspa\Big\Session\Enums\SourceSystem;
use Ntvspa\Big\Session\Services\Login;
use Ntvspa\Big\Session\Structs\LoginRequest;
use Ntvspa\Big\Session\Structs\LoginResponse;

>setSourceSystem(SourceSystem::VALUE_FOREIGN_AGENCY)
    ->setLogin(
        (new \Ntvspa\Big\Session\Structs\Login())
            ->setUsername($username)
            ->setPassword($password)
            ->setDomain($domain));

if ($oLoginSvc->Login($oLoginReq) !== false) {
    /** @var LoginResponse $result */
    $result = $oLoginSvc->getResult();
} else {
    /** @var \SoapFault[] $result */
    $result = $oLoginSvc->getLastError();
    foreach ($result as $error) {
        if ($error instanceof \SoapFault) {
            echo "SoapFault: ", $error->getMessage(), PHP_EOL;
        } else {
            echo get_class($error), ": ", $error->getMessage(), PHP_EOL;
        }
    }
    exit;
}

print("--------------- Result map to class ------------------". PHP_EOL);
print(get_class($result). PHP_EOL);

print("--------------- Agent ------------------". PHP_EOL);
print(json_encode($result->getAgent()->jsonSerialize(), JSON_PRETTY_PRINT). PHP_EOL);

print("--------------- Signature ------------------". PHP_EOL);
print($result->getSignature(). PHP_EOL);