PHP Classes

Calcular Frete Correios PHP Class: Calculate shipping costs for the Correios services

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (2)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2023-10-30 (6 months ago) RSS 2.0 feedStarStarStarStar 61%Total: 105 All time: 9,710 This week: 74Up
Version License PHP version Categories
frete-correios 1.0.4BSD License5PHP 5, E-Commerce, Web services


This package is specific mainly for applications used in Brazil Brazil .

This class can calculate the shipping costs for sending parcels using the Correios of Brazil post office company services.

It can send HTTP requests to the Correios Web services API to request quotes for sending parcels using different shipping options using Correios services.

The class supports calculating shipping costs for either national or international destinations.

Em Português:

Esta classe pode calcular os custos de envio para o envio de encomendas usando os serviços dos Correios do Brasil.

A classe pode enviar pedidos HTTP para a API de Web services dos Correios para solicitar orçamentos para envio de encomendas usando diferentes opções de envio usando os serviços dos Correios.

A classe suporta o cálculo dos custos de envio para destinos nacionais ou internacionais.

Picture of Manuel Lemos
  Performance   Level  
Name: Manuel Lemos is available for providing paid consulting. Contact Manuel Lemos .
Classes: 45 packages by
Country: Portugal Portugal
Age: 55
All time rank: 1
Week rank: 5 Down1 in Portugal Portugal Equal


 * correios_calcula_frete_nacional.php
 * @(#) $Id: correios_calcula_frete_nacional.php,v 1.4 2023/10/29 10:53:35 mlemos Exp $


Header('Content-Type: text/html; charset=utf-8');

$correios = new correios_calcula_frete_class;
$correios->depurar = true;
$correios->depurar_http = false;
$correios->depurar_respostas_de_http = false;
$correios->depurar_em_html = true;
$correios->registrar_depuracao = false;
$correios->arquivo_de_registro_de_depuracao = '';
$correios->diretorio_de_cache = '';
$correios->api_user = '';
$correios->api_password = '';
$correios->cartao_de_postagem = '';
$parameters = array(
'Correios Mini Envios',
$success = $correios->CalculaFreteNacional($parameters);
<title>Cálculo de Frete Nacional dos Correios</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<h1 style="text-align: center">Cálculo de Frete Nacional dos Correios</h1>
<hr />
'<pre>', nl2br(print_r($parameters['Opcoes'], 1)), '</pre>';
<h2 style="text-align: center">Erro: <?php echo $correios->erro ?></h2>
<hr />

  Files folder image Files  
File Role Description
Plain text file correios_calcula_frete.php Class Classe para obter os valores do frete de encomendas enviadas pelos Correios
Accessible without login Plain text file correios_calcula_frete_internacional.php Example Exemplo para obter os valores do frete internacional de encomendas enviadas pelos Correios
Accessible without login Plain text file correios_calcula_frete_nacional.php Example Exemplo para obter os valores do frete nacional de encomendas enviadas pelos Correios
Accessible without login Plain text file verificar_frete_internacional.php Example Script de verificacao da possibilidade de entrega de multiplos destinatarios de uma vez so 9KB
Downloadfrete-correios-2023-10-30.tar.gz 7KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
Generic XML parser class Download .zip .tar.gz Parse the response for Correios API to get shipping costs for national deliveries Conditional
Simple Authentication and Security Layer Download .zip .tar.gz Access pages that require authentication Conditional
PHP HTTP protocol client Download .zip .tar.gz Access Correios API via HTTP Required
File cache class Download .zip .tar.gz Cache the responses of Correios API to avoid the delay of calling the API multiple times to obtain the same responses Required
 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,710
This week:74Up
User Ratings User Comments (1)
 All time
Useful and comprehensive, but I missed annotations on code an...
3 years ago (Carlos Artur Curvelo da Matos)