Please enable JS

Exemplos

Ler Documento

ID Documento
Exemplo: CAFBB4AD-9927-11DC-A3E8-0020E024149C

Código Fonte

<?php

require_once '../vendor/autoload.php';

use Swagger\Client\Api\DocumentApi;
use Swagger\Client\ApiException;

// PARAMETERS
$id = clear('id');

// E2E ACCESS KEYS
$client = new GuzzleHttp\Client([
    'headers' => [
        'api_key' => 'JHSV2V6KyqcbxvMHshRlPfunJymVt7GDfXyoK229o=',
        'company_key' => 'E2ELIVE',
    ]
]);

try {
    
    // READ DOCUMENT
    $api = new DocumentApi($client);
    $result = $api->documentId($id);
    
    header('Content-Type: application/json; charset=utf-8');
    echo $result->__toString();
    
} catch (Exception $e) {
    
    http_response_code($e->getCode());
    
    $msg = $e instanceof ApiException ? $e->getResponseBody() : $e->getMessage();
    
    if (!empty($msg)) {
        echo $msg;
    }
}

function clear($field)
{
    return empty($_REQUEST[$field]) ? null : $_REQUEST[$field];
}