Modal ajax tracking mails

0

Is it possible to make a script that pulls the trace of some item on the post page? For example, within my site: link . There you have the link in the case for tracking PO117284423BR

I would like to create a modal that when the link "PO117284423BR" is clicked it opens with this:

Or something like that. It's possible? Or the post office has no way?

    
asked by anonymous 08.06.2017 / 16:20

2 answers

3

Unfortunately you will not be able to use the post office directly.

You will need to develop an application that uses the Post API (manual posted by Felipe), make a request for the post office and return with the tracking information, and then you can assemble 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 in order to use the WS of the mail and make this request.

One alternative is to use another site that does all this work for you. I found this one: link

It looks like you just add the tracking code to the end of the URL and you're done: link

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

    
08.06.2017 / 16:59
0

The following HTML code gets this trace 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 hint:

If you want to view trace data quickly on the terminal, use curl to send the request to the post 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
    
06.12.2018 / 18:42