Skip to content

Instantly share code, notes, and snippets.

@diegofelix
Created February 20, 2018 12:05
Show Gist options
  • Save diegofelix/ad15d85d1ed125f793c969858177cc1a to your computer and use it in GitHub Desktop.
Save diegofelix/ad15d85d1ed125f793c969858177cc1a to your computer and use it in GitHub Desktop.
Calculate Shipment Cost on Correios
<?php
$client = new SoapClient('http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx?WSDL');
try {
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
$resposta = $client->CalcPrazo([
'nCdServico' => '40010', // Sedex
'sCepOrigem' => '12235360', // CEP Origem
'sCepDestino' => '04690000', // Cep Destino
]);
var_dump($resposta->CalcPrazoResult->Servicos);
} catch (SoapFault $e) {
echo $e->getMessage();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment