Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function conectar_correios5_curl($url){
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_FAILONERROR, false);
- $result = curl_exec($ch);
- curl_close($ch);
- $xml = @simplexml_load_string($result);
- if(!is_object($xml)) {
- return false;
- }
- return $xml;
- }
- //testa a conexao aos correios
- $url = 'http://ws.correios.com.br/calculador/CalcPrecoPrazo.aspx?nCdEmpresa=&sDsSenha=&sCepOrigem=22450000&sCepDestino=22450000&nVlPeso=1,00&nCdFormato=1&nVlComprimento=20,00&nVlLargura=20,00&nVlAltura=20,00&sCdMaoPropria=n&nVlValorDeclarado=27,00&sCdAvisoRecebimento=n&nCdServico=41106,40010,40045&nVlDiametro=0&StrRetorno=xml';
- print_r(conectar_correios5_curl($url));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement