PHP code example of crmdesenvolvimentos / api-braspress
1. Go to this page and download the library: Download crmdesenvolvimentos/api-braspress 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/ */
crmdesenvolvimentos / api-braspress example snippets
composer
use Crmdesenvolvimentos\ApiBraspress\Braspress;
$api = new Braspress();
$api
->setEnvironment(Braspress::DEVELOPMENT)
->setTimeout(10)
->setMode(Braspress::MODE_FREIGHT)
->setCnpjRemetente('60701190000104')
->setUser('user')
->setPassword('password');
$api->freight
->setCnpjDestinatario('30539356867')
->setModal('R')
->setTipoFrete(1)
->setCepOrigem('02323000')
->setCepDestino('07093090')
->setVlrMercadoria(100.00)
->setPeso(50.00)
->setVolumes(100);
$api->freight
->getCubagem()
->newItem(0.67, 0.67, 0.46, 10);
$response = $api->send();
//Response
Array
(
'id' => 147670114, // id da cotação
'prazo' => 5, // prazo de entrega
'totalFrete' => 42.14, // valor da cotação
'validade' => '2022-08-29 23:59:59', // validade da cotação
'datetime' => '2022-08-29 16:01:34', // data-hora da requisição
);