1 | <?php namespace zServices\ReceitaFederal\Services\Portais\AN; |
||
10 | class Service implements ServiceInterface { |
||
11 | /** |
||
12 | * Armazena as URLs e selectors do serviço a ser consultado |
||
13 | * @var array |
||
14 | */ |
||
15 | public $configurations = [ |
||
16 | 'base' => 'http://www.receita.fazenda.gov.br', |
||
17 | 'home' => 'http://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/Cnpjreva_Solicitacao2.asp', |
||
18 | 'captcha' => 'http://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/captcha/gerarCaptcha.asp', |
||
19 | 'data' => 'http://www.receita.fazenda.gov.br/pessoajuridica/cnpj/cnpjreva/valida.asp', |
||
20 | 'selectors' => [ |
||
21 | 'image' => '', |
||
22 | 'data' => [ |
||
23 | 'error' => 'body > table:nth-child(3) > tr:nth-child(2) > td > b > font', |
||
24 | 'numero_inscricao' => 'body > table:nth-child(3) > tr > td > table:nth-child(3) > tr > td:nth-child(1) > font:nth-child(3) > b:nth-child(1)', |
||
25 | 'classificacao' => 'body > table:nth-child(3) > tr > td > table:nth-child(3) > tr > td:nth-child(1) > font:nth-child(3) > b:nth-child(3)', |
||
26 | 'data_abertura' => 'body > table:nth-child(3) > tr > td > table:nth-child(3) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
27 | 'nome_empresarial' => 'body > table:nth-child(3) > tr > td > table:nth-child(5) > tr > td > font:nth-child(3) > b', |
||
28 | 'nome_fantasia' => 'body > table:nth-child(3) > tr > td > table:nth-child(7) > tr > td > font:nth-child(3) > b', |
||
29 | 'cnae_principal' => 'body > table:nth-child(3) > tr > td > table:nth-child(9) > tr > td > font:nth-child(3) > b', |
||
30 | 'cnae_secundarios' => ['body > table:nth-child(3) > tr > td > table:nth-child(11) > tr > td' => 'td > font > b'], |
||
31 | 'natureza_juridica' => 'body > table:nth-child(3) > tr > td > table:nth-child(13) > tr > td > font:nth-child(3) > b', |
||
32 | 'endereco' => 'body > table:nth-child(3) > tr > td > table:nth-child(15) > tr > td:nth-child(1) > font:nth-child(3) > b', |
||
33 | 'numero' => 'body > table:nth-child(3) > tr > td > table:nth-child(15) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
34 | 'complemento' => 'body > table:nth-child(3) > tr > td > table:nth-child(15) > tr > td:nth-child(5) > font:nth-child(3) > b', |
||
35 | 'cep' => 'body > table:nth-child(3) > tr > td > table:nth-child(17) > tr > td:nth-child(1) > font:nth-child(3) > b', |
||
36 | 'distrito' => 'body > table:nth-child(3) > tr > td > table:nth-child(17) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
37 | 'municipio' => 'body > table:nth-child(3) > tr > td > table:nth-child(17) > tr > td:nth-child(5) > font:nth-child(3) > b', |
||
38 | 'uf' => 'body > table:nth-child(3) > tr > td > table:nth-child(17) > tr > td:nth-child(7) > font:nth-child(3) > b', |
||
39 | 'email' => 'body > table:nth-child(3) > tr > td > table:nth-child(19) > tr > td:nth-child(1) > font:nth-child(3) > b', |
||
40 | 'telefone' => 'body > table:nth-child(3) > tr > td > table:nth-child(19) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
41 | 'efr' => 'body > table:nth-child(3) > tr > td > table:nth-child(21) > tr > td > font:nth-child(3) > b', |
||
42 | 'situacao' => 'body > table:nth-child(3) > tr > td > table:nth-child(23) > tr > td:nth-child(1) > font:nth-child(3) > b', |
||
43 | 'data_situacao' => 'body > table:nth-child(3) > tr > td > table:nth-child(23) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
44 | 'motivo_situacao' => 'body > table:nth-child(3) > tr > td > table:nth-child(25) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
45 | 'situacao_especial' => 'body > table:nth-child(3) > tr > td > table:nth-child(27) > tr > td:nth-child(1) > font:nth-child(3) > b', |
||
46 | 'data_situacao_especial' => 'body > table:nth-child(3) > tr > td > table:nth-child(27) > tr > td:nth-child(3) > font:nth-child(3) > b', |
||
47 | ], |
||
48 | ], |
||
49 | 'headers' => [ |
||
50 | 'Origin' => 'http://www.receita.fazenda.gov.br', |
||
51 | 'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0', |
||
52 | 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', |
||
53 | 'Accept-Language' => 'pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3', |
||
54 | 'Accept-Encoding' => 'gzip, deflate', |
||
55 | 'Host' => 'www.receita.fazenda.gov.br', |
||
56 | ], |
||
57 | ]; |
||
58 | |||
59 | /** |
||
60 | * Search instance |
||
61 | * @var object |
||
62 | */ |
||
63 | private $search; |
||
64 | |||
65 | /** |
||
66 | * Get search instance |
||
67 | * @return void |
||
|
|||
68 | */ |
||
69 | public function __construct() { |
||
72 | |||
73 | /** |
||
74 | * Executa primeira requisição preparando |
||
75 | * o cookie e captcha |
||
76 | * @return Service |
||
77 | */ |
||
78 | public function request() { |
||
83 | |||
84 | /** |
||
85 | * Retorna o base64 da imagem do captcha |
||
86 | * @return string base64_image |
||
87 | */ |
||
88 | public function captcha() { |
||
91 | |||
92 | /** |
||
93 | * Cookie da requisição |
||
94 | * @return string |
||
95 | */ |
||
96 | public function cookie() { |
||
99 | |||
100 | /** |
||
101 | * DecaptcherServiceInterface from decaptcher |
||
102 | * |
||
103 | * Impoe o serviço a ser utilizado para efetuar a quebra do captcha |
||
104 | * @param DecaptcherServiceInterface $decaptcher |
||
105 | * @return Search |
||
106 | */ |
||
107 | public function decaptcher(DecaptcherServiceInterface $decaptcher) { |
||
112 | |||
113 | /** |
||
114 | * Get params |
||
115 | * @return array |
||
116 | */ |
||
117 | public function params() { |
||
120 | |||
121 | /** |
||
122 | * Informações da entidade no serviço |
||
123 | * @param boolean $document |
||
124 | * @param false|string $cookie |
||
125 | * @param false|string $captcha |
||
126 | * @return array |
||
127 | */ |
||
128 | public function data($document, $cookie, $captcha, array $params = []) { |
||
131 | } |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.