|
@@ -12,7 +12,7 @@ discard block |
|
|
block discarded – undo |
|
12
|
12
|
const URL_REFER = 'https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_solicitacao3.asp'; |
|
13
|
13
|
const URL_POST = 'https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/valida.asp'; |
|
14
|
14
|
|
|
15
|
|
- private $attributes =[ |
|
|
15
|
+ private $attributes = [ |
|
16
|
16
|
'NOME EMPRESARIAL' => 'razao_social', |
|
17
|
17
|
'TÍTULO DO ESTABELECIMENTO (NOME DE FANTASIA)' => 'nome_fantasia', |
|
18
|
18
|
'CÓDIGO E DESCRIÇÃO DA ATIVIDADE ECONÔMICA PRINCIPAL' => 'cnae_principal', |
|
@@ -106,8 +106,8 @@ discard block |
|
|
block discarded – undo |
|
106
|
106
|
|
|
107
|
107
|
if ($response->getStatusCode() == 200) { |
|
108
|
108
|
$contents = $response->getBody()->getContents(); |
|
109
|
|
- if (preg_match_all('/<table border="0" width="100%" style="\s+BORDER-COLLAPSE: collapse;\s+">.*?<\/table>/ism', $contents , $matches)) { |
|
110
|
|
- foreach($matches[0] as $html) { |
|
|
109
|
+ if (preg_match_all('/<table border="0" width="100%" style="\s+BORDER-COLLAPSE: collapse;\s+">.*?<\/table>/ism', $contents, $matches)) { |
|
|
110
|
+ foreach ($matches[0] as $html) { |
|
111
|
111
|
$result = array_merge($result, $this->parseCNPJ($html)); |
|
112
|
112
|
} |
|
113
|
113
|
} |
|
@@ -133,7 +133,7 @@ discard block |
|
|
block discarded – undo |
|
133
|
133
|
|
|
134
|
134
|
if ($info->count() > 0) { |
|
135
|
135
|
$key = trim(strip_tags(preg_replace('/\s+/', ' ', $info->html()))); |
|
136
|
|
- $attr = isset($this->attributes[$key]) ? $this->attributes[$key] : null; |
|
|
136
|
+ $attr = isset($this->attributes[$key]) ? $this->attributes[$key] : null; |
|
137
|
137
|
|
|
138
|
138
|
if ($attr === null) { |
|
139
|
139
|
continue; |