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