PHP code example of dgac / nmb2b-phpclient

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

    

dgac / nmb2b-phpclient example snippets


use DSNA\NMB2BDriver\NMB2BClient;

//only add path to services you intend to use
$client = new NMB2BClient(
    "path to certificate", 
    "passphrase", 
    array(
        "airspaceservices" => "path to airspace services wsdl file",
        "flowservices" => "path to flow services wsdl file"
    )
);

//with a proxy :
$options = [
   'proxy_host' => '192.x.x.x',
   'proxy_port' => '8080'
];

$client = new NMB2BClient(
    "path to certificate", 
    "passphrase", 
    array(
        "airspaceservices" => "path to airspace services wsdl file",
        "flowservices" => "path to flow services wsdl file"
    ),
    $options
);


$eaupchain = $client->airspaceServices()->retrieveEAUPChain(new \DateTime('now'));

//Get last AUP sequence number published before 0600 UTC
$seq = $eaupchain->getAUPSequenceNumber()


$start = new \DateTime('2018-04-18 00:00:00');
$end = new \DateTime('2018-04-18 23:59:59');

$result = $client->flowServices()->queryRegulations($start, $end, 'LF*');

foreach($result->getRegulations() as $regulation) {
    $name = $regulation->getRegulationName();
}


$client->airspaceServices()->getNMVersion(); //returns "21.5.0"