1 | <?php |
||
2 | |||
3 | /** MODULO CRIADO POR ODLANIER |
||
4 | * @author Odlanier de Souza Mendes |
||
5 | * @copyright Dlani |
||
6 | * @email [email protected] |
||
7 | * @email [email protected] |
||
8 | **/ |
||
9 | |||
10 | @ini_set('display_errors', 'OFF'); |
||
11 | |||
12 | if (isset($_GET['objeto']) && $_GET['objeto']) { |
||
13 | $objeto = $_GET['objeto']; |
||
14 | }else{ |
||
15 | $objeto = 'AA999999999BR0'; |
||
16 | } |
||
17 | |||
18 | $url = "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=$objeto"; |
||
19 | |||
20 | $doc = new DOMDocument(); |
||
21 | $ndoc = new DOMDocument(); |
||
22 | |||
23 | $ndoc->loadHTMLFile( dirname(__FILE__) . '/template_reastreio.html' ); |
||
24 | |||
25 | $doc->loadHTMLFile($url); |
||
26 | |||
27 | $table = $doc->getElementsByTagName('table')->item(0); |
||
28 | |||
29 | $fonts = $table->getElementsByTagName('font'); |
||
30 | |||
31 | foreach( $fonts as $font ) |
||
32 | if( $font->getAttribute('color') === '000000' ) |
||
33 | $font->setAttribute('color', "#cc9966"); |
||
34 | |||
35 | |||
36 | if( is_null($table) ){ |
||
37 | $add = $ndoc->createTextNode('Nenhum objeto encontrado com esse nĂºmero de rastreio!'); |
||
38 | } |
||
39 | else{ |
||
40 | $add = $ndoc->importNode( $table, true ); |
||
41 | |||
42 | } |
||
43 | |||
44 | $div = $ndoc->getElementById('table'); |
||
45 | $div->appendChild($add); |
||
46 | |||
47 | echo $ndoc->saveHTML(); |