-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrete.php
More file actions
38 lines (38 loc) · 1.12 KB
/
Copy pathfrete.php
File metadata and controls
38 lines (38 loc) · 1.12 KB
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
<!DOCTYPE html>
<html>
<head>
<title>Calcula Frete</title>
<meta charset="utf-8">
</head>
<body>
<form>
<input type="" name="cep_o">
<input type="" name="cep_d">
<input type="" name="p">
<input type="" name="a">
<input type="" name="l">
<input type="" name="c">
<input type="submit" name="VAI">
</form>
</body>
</html>
<?php
function calculaFrete($cep_origem, $cep_destino, $peso, $altura, $largura, $comprimento, $valor_declarado='0'){
$cod_servico = 40010;
$correios = "http://ws.correios.com.br/calculador/CalcPrecoPrazo.aspx?nCdEmpresa=&sDsSenha=&sCepOrigem=".$cep_origem."&sCepDestino=".$cep_destino."&nVlPeso=".
$peso."&nCdFormato=1&nVlComprimento=".$comprimento."&nVlAltura=".$altura."&nVlLargura=".$largura."&sCdMaoPropria=n&nVlValorDeclarado=".$valor_declarado.
"&sCdAvisoRecebimento=n&nCdServico=".$cod_servico."&nVlDiametro=0&StrRetorno=xml";
$xml = simplexml_load_file($correios);
var_dump($xml);
$vet = array();
$vet["valor"] = $xml;
print_r($vet["valor"]);
}
$co = $_GET["cep_o"];
$cd = $_GET["cep_d"];
$p = $_GET["p"];
$a = $_GET["a"];
$l = $_GET["l"];
$c = $_GET["c"];
calculaFrete ($co, $cd, $p, $a, $l, $c);
?>