Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need some help with a .cfm output...

Guest
Aug 31, 2010 Aug 31, 2010

Not Sure if this would be the right forum. But here is the puzzler.  I'm trying to capture the information sent by a .cfm page.  "URL" ..  It's for an XML form which is no longer working on my program.

Here is the site

http://www.correios.com.br/encomendas/prazo/default.cfm         It's the Brazilian post office.

If you enter the data

servico = Pac

CEP de Origem: 70660-054

CEP de Destino: 71050-161

Peso estimado até:
Kg   =  10

Comprimento:  28 cm      Largura: 20 cm  Altura: 20 cm  

Then press "calcular"

**************************************

You should get this result:

CEP:    70660054    71050161
Endereço:    AOS 5 Bloco D    QE 15 Conjunto P
Bairro:    Área Octogonal    Guará II
Cidade/UF:    Cruzeiro/DF    Guará/DF
Prazo de Entrega:    3 DIAS ÚTEIS 
Dias de entrega:   
Segunda a Sexta-feira.
Valor do Frete:     R$ 18,70

The challenge here is to capture how the data (url) is sent to the site.  It should look something like this:

"ws.correios.com.br/calculador/CalcPrecoPrazo.aspx?nCdEmpresa=&sDsSenha=&sCepOrigem=%s&sCepDestino=%s&nVlPeso=%s&nCdFormato=1&nVlComprimento=25&nVlAltura=2&nVlLargura=5&sCdMaoPropria=n&nVlValorDeclarado=%s&sCdAvisoRecebimento=n&nCdServico=41106&nVlDiametro=0"


The code I have is generating errors. Thus I would like to find out what's sent to the correios by the submit button using the parameters above.

Can anyone help me with this ?

Thank you for the help.

Fabio

823
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 31, 2010 Aug 31, 2010

Firefox tools such as "Live HTTP Headers" and|or "Firebug" (among others) will provide all the details of the request sent to the server, including GET, POST and COOKIE header keys and values.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 31, 2010 Aug 31, 2010

You did not say exactly what the error is, and it is not fair to make us guess.

It is hard to tell based on the formatting of this forum post, but it looks like you have spaces in the URL. That is not allowed by most browsers, although IE used to allow for them.

My question is.... why are you not using form fields and submissions rather than appending all of the variables to the URL?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 31, 2010 Aug 31, 2010

Thank you guys for the help. The error e very very strange. For instance, if I apply the code:

http://www.correios.com.br/encomendas/precos/calculo.cfm?servico=40010&cepOrigem=74085-320&cepDestino=70660-054&peso=10&valorD=&Formato=1&Comprimento=30&Largura=20&Altura=20&MaoPropria=N&valorDeclarado=&avisoRecebimento=N&embalagem=&resposta=xml

I get in return:

"<?xml version="1.0" encoding="ISO-8859-1" ?>
<calculo_precos>
<versao_arquivo>1.0</versao_arquivo>
<dados_postais>
<servico>40010</servico>
<servico_nome>SEDEX</servico_nome>
<uf_origem>GO</uf_origem>
<local_origem>Capital</local_origem>
<cep_origem>74085320</cep_origem>
<uf_destino>DF</uf_destino>
<local_destino>Capital</local_destino>
<cep_destino>70660054</cep_destino>
<peso>10</peso>
<mao_propria>0</mao_propria>
<aviso_recebimento>0</aviso_recebimento>
<valor_declarado>0</valor_declarado>
<tarifa_valor_declarado>0</tarifa_valor_declarado>
<preco_postal>27.4</preco_postal>
</dados_postais>
<erro>
<codigo>0</codigo>
<descricao></descricao>
</erro>
</calculo_precos>"

From this return what I'm looking for is this:
<preco_postal>27.4</preco_postal> =  which is the cost for shipping for SEDEX

The error I get for PAC is:
<descricao>Erro ao calcular a tarifa.</descricao>


However, when I try for "Pac" It does not work.  That's where I have the error.

Service = 40010  is for Sedex. The XML above works fine.
Service = 41106  is for Pac. I'm not getting the correct XML which would work. 

The problem I have is that I need the XML code for PAC.

Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 31, 2010 Aug 31, 2010

The reason I'm appending all the variables to the URL is because, the shipping calculation is done from a shopping cart outside of the Correios.  When the costumer finishes his shopping, the software will calculate the shipping  via sending an URL to Correios and grabbing the XML.  For SEDEX it works fine, for PAC no no... 


For instance.

Thank you guys for the help. The error e very very strange. For instance, if I apply the code:

http://www.correios.com.br/encomendas/precos/calculo.cfm?servico=40010 &cepOrigem=74085-320&cepDesti...

I get in return:

"<?xml version="1.0" encoding="ISO-8859-1" ?>
<calculo_precos>
<versao_arquivo>1.0</versao_arquivo>
<dados_postais>
<servico>40010</servico>
<servico_nome>SEDEX</servico_nome>
<uf_origem>GO</uf_origem>
<local_origem>Capital</local_origem>
<cep_origem>74085320</cep_origem>
<uf_destino>DF</uf_destino>
<local_destino>Capital</local_destino>
<cep_destino>70660054</cep_destino>
<peso>10</peso>
<mao_propria>0</mao_propria>
<aviso_recebimento>0</aviso_recebimento>
<valor_declarado>0</valor_declarado>
<tarifa_valor_declarado>0</tarifa_valor_declarado>
<preco_postal>27.4</preco_postal>
</dados_postais>
<erro>
<codigo>0</codigo>
<descricao></descricao>
</erro>
</calculo_precos>"

From this return what I'm looking for is this:
<preco_postal>27.4</preco_postal> =  which is the cost for shipping for SEDEX

The error I get for PAC is:
<descricao>Erro ao calcular a tarifa.</descricao>


However, when I try for "Pac" It does not work.  That's where I have the error.

Service = 40010  is for Sedex. The XML above works fine.
Service = 41106  is for Pac. I'm not getting the correct XML which would work. 

The problem I have is that I need the XML code for PAC.

Thank you.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 31, 2010 Aug 31, 2010
LATEST

fab26x wrote:

For SEDEX it works fine, for PAC no no... 

That sounds like a limitation|problem with this correios service.  Which is not something we are going to likely be able to help you with.

If you can somehow make a request to this service for this "PAC" data, and you can show us how you make that request, we can probably show you how to get ColdFusion to make the same request.

But just saying "When I make a request for PAC, I get an Error", about the only response we can make is "Don't make a request for PAC!"

Or, slightly more helpful.  Contact this "Cerreios" service and ask them why you get an error when you make this "PAC" request.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources