Created
March 28, 2017 02:47
-
-
Save jjcodes78/a009834b04e4bd0e1a85705c10a9813c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// metodo pra obter os dados do estabelecimento | |
function getIdentificacao($table) | |
{ | |
$table = $table->nextSibling(); | |
$identificacao = []; | |
foreach ($table->children() as $tr) { | |
// monta as $keys de origem de dados | |
$keys = [ | |
'Nome:', | |
'Nome Empresarial:', | |
'Logradouro:', | |
'Complemento:', | |
'Tipo Unidade:', | |
'Atividade Ensino/Pesquisa:' | |
]; | |
foreach ($keys as $key) { | |
if ($tr->children(0) != null) { | |
if ($tr->children(0)->plaintext == $key) { | |
$td_data = $tr->nextSibling(); | |
foreach ($td_data->children() as $field) { | |
if ($field->tag == 'td') { | |
$content = trim($field->plaintext); | |
$identificacao[] = $content; | |
} | |
} | |
} | |
} | |
} | |
} | |
return $identificacao; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment