-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteste.php
83 lines (36 loc) · 1.53 KB
/
teste.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
try {
$opts = array(
'http'=>array(
'user_agent' => 'PHPSoapClient'
)
);
$context = stream_context_create($opts);
$client = new SoapClient('http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx?WSDL', array('stream_context' => $context,
'cache_wsdl' => WSDL_CACHE_NONE));
$function = 'CalcPrecoPrazo';
$arguments= array('CalcPrecoPrazo' => array(
'nCdEmpresa' => 9912351440,
'sDsSenha' => '19380699',
'nCdServico' => 41106,
'sCepOrigem' => '08653300',
'sCepDestino' => '09112000',
'nVlPeso' => 0.05,
'nCdFormato' => 1,
'nVlComprimento' => 16,
'nVlAltura' => 2,
'nVlLargura' => 11,
'nVlDiametro' => 0,
'sCdMaoPropria' => 'N',
'nVlValorDeclarado' => 0,
'sCdAvisoRecebimento' => 'N'
));
$options = array('location' => 'http://ws.correios.com.br/calculador/CalcPrecoPrazo.asmx');
$result = $client->__soapCall($function, $arguments, $options);
$valor_frete = $_SESSION['fechamento']['valorFrete'] = $result->CalcPrecoPrazoResult->Servicos->cServico->Valor;
echo $valor_frete;
} catch(Exception $e) {
echo '<pre>';
print_r($e);
}
?>