PHP code example of webempresario / api-sii-chile

1. Go to this page and download the library: Download webempresario/api-sii-chile 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/ */

    

webempresario / api-sii-chile example snippets


use Webempresario\ApiSiiChile\Client;
use Webempresario\ApiSiiChile\ApiException;

$client = new Client('TU_API_KEY');

try {
    $empresa = $client->consultarRut('93834000-5');
    echo $empresa['RAZON_SOCIAL'];

    foreach ($empresa['domicilios'] as $domicilio) {
        echo $domicilio['GEO']['LAT'] . ', ' . $domicilio['GEO']['LON'];
    }
} catch (ApiException $e) {
    echo 'Error: ' . $e->getMessage();
}