Modal ajax tracking couriers

Is it possible to make a script that pulls the tracking of some item on the post office page? For example, Inside My site: https://meusite.com.br/pedidos. Ai has the link in the case for tracking PO117284423BR

Would have like to create a modal that when the link "PO117284423BR" is clicked it opens with this: insert the description of the image here

Or something like that. Is that possible? Or with the Post Office website do not have how?

Author: Lucas de Carvalho, 2017-06-08

2 answers

Unfortunately you will not be able to use the Post Office website directly.

You will need to develop an application, which using the post office API (manual posted by Felipe), make a request to the Post Office website and return with the tracking information, and then you can set up a page to display the result.

From what I read on Page 11 of the manual, you will need to request a username and password to be able to use the mail WS and do this request.

An alternative, would be to use another site that does all this work for you. I found this one here: http://www.linkcorreios.com.br

It seems like just add the tracking code to the end of the URL and you're done: http://www.linkcorreios.com.br/?id=PO117284423BR

You can place this link on your website, and have it open in a modal or in another window.

 3
Author: Diego Keller, 2017-06-08 14:59:02

The following HTML code gets this tracking data:

<html>
<body onload="document.aux.submit()">

 <form name="aux" method="POST" action="https://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm">
  <input name="Objetos" value="PO117284423BR">
 </form>

</body>
</html>

A tip:

If you want to view tracking data quickly on the terminal, use curl to send the request to the post office page, and a text-mode browser to view the status of the request, such as html2text, elinks, lynx or w3m. For example, using bash in the terminal of Ubuntu:

sudo apt install html2text
curl -sS -X POST -d Objetos=PO117284423BR https://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm | html2text

Or

sudo apt install elinks 
curl -sS -X POST -d Objetos=PO117284423BR https://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm | elinks -dump -dump-color-mode 1

Or

sudo apt install lynx    
curl -sS -X POST -d Objetos=PO117284423BR https://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm | lynx --stdin --dump

Or

sudo apt install w3m    
curl -sS -X POST -d Objetos=PO117284423BR https://www2.correios.com.br/sistemas/rastreamento/resultado_semcontent.cfm | w3m -dump -T text/html
 0
Author: Alessander Botti Benevides, 2018-12-06 17:42:58