PHP code example of brenno-duarte / correios-api

1. Go to this page and download the library: Download brenno-duarte/correios-api 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/ */

    

brenno-duarte / correios-api example snippets




use CorreiosAPI\CorreiosAPI;

$cep = new CorreiosAPI();

$res = $cep->buscaCEP('01408001');

var_dump($res);

$res = $cep->buscaCEP(null, "CE", "Iguatu", "Nelson");

var_dump($res);

$res = $cep->calcPrecoPrazo('40010', '01408001', '63504210', '2', '1', '80', '20', '20', '91');

var_dump($res);

$res = $cep->calcPrecoPrazo('40010', '01408001', '63504210', '2', '1', '80', '20', '20', '91', 'N', '0', 'N', 'xml');

var_dump($res);

$res = $cep->rastrear("AA123456789BR");

var_dump($res);

$res = $cep->disqueColeta('01408001');

var_dump($res);

$res = $cep->restricaoEntrega("04510", "63504210", "01408001");

var_dump($res);

$res = $cep->consultaDetranCE("pnx9620");

var_dump($res);