PHP code example of madmatt / id3global-service

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

    

madmatt / id3global-service example snippets


// Assumes $service is an instance of ID3Global\Service\GlobalAuthenticationService

// Return the last SOAP request made to the ID3global API as a string
$lastRawRequest = $service->getLastRawRequest();

// Returns the SoapClient interpreted response from the API (this will be an object of type \stdClass, or null if the SOAP request failed entirely
// For example you can access the BandText of a valid response with $lastResponse->AuthenticateSPResult->BandText
$lastResponse = $service->getLastVerifyIdentityResponse();

// Access the underlying SoapClient object to perform more detailed debugging
$gateway = $service->getGateway(); // Returns a ID3Global\Gateway\GlobalAuthenticationGateway object
$soapClient = $gateway->getSoapClient(); // Returns a ID3Global\Gateway\SoapClient\ID3GlobalSoapClient object

// You can then do anything you'd normally do on SoapClient, such as:
$lastRawRequestHeaders = $soapClient->__getLastRequestHeaders(); // Returns an array of the headers sent to the API
$lastRawResponse = $soapClient->__getLastResponse(); // Returns the last response returned by the API

$service = new ID3Global\Service\GlobalAuthenticationService;

// Must be set before calling ->verifyIdentity()
$service->setVerboseExceptionHandling(true);

// Either way, regardless of whether or not you enable verbose exception handling, IdentityVerificationFailureException will still contain the response
try {
    $service->verifyIdentity($identity, 'customer reference');
} catch (IdentityVerificationFailureException $e) {
    /** @var stdClass $response */
    $response = $e->getResponse();
}