Skip to content

Commit

Permalink
🔀 Merge pull request #1 from rickinbsb/master
Browse files Browse the repository at this point in the history
🔒️ https nas urls da receita
  • Loading branch information
dsousap authored Apr 13, 2021
2 parents 348433d + 363a0a6 commit 5d18b33
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/CnpjGratis.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ class CnpjGratis {
*/
public static function getParams()
{
$data = self::request('http://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_Solicitacao.asp');
$data = self::request('https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_Solicitacao.asp');
$cookie = $data['headers']['Set-Cookie'];
$image = self::request('http://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/captcha/gerarCaptcha.asp', [], [
$image = self::request('https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/captcha/gerarCaptcha.asp', [], [
"Pragma: no-cache",
"Origin: http://www.receita.fazenda.gov.br",
"Origin: https://www.receita.fazenda.gov.br",
"Host: servicos.receita.fazenda.gov.br",
"User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:32.0) Gecko/20100101 Firefox/32.0",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language: pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3",
"Accept-Encoding: gzip, deflate",
"Referer: http://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_Solicitacao.asp",
"Referer: https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_Solicitacao.asp",
"Cookie: flag=1; $cookie",
"Connection: keep-alive"
]);
Expand Down Expand Up @@ -57,7 +57,7 @@ public static function consulta($cnpj, $captchaSolved, $cookie)
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
"Accept-Language: pt-BR,pt;q=0.9,en;q=0.8",
"Accept-Encoding: gzip, deflate",
"Referer: http://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_Solicitacao_CS.asp",
"Referer: https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/Cnpjreva_Solicitacao_CS.asp",
"Cookie: $cookie",
"Connection: keep-alive"
];
Expand All @@ -67,7 +67,7 @@ public static function consulta($cnpj, $captchaSolved, $cookie)
'txtTexto_captcha_serpro_gov_br' => $captchaSolved,
'search_type' => 'cnpj'
];
$data = self::request('http://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/valida.asp', $params, $headers);
$data = self::request('https://servicos.receita.fazenda.gov.br/Servicos/cnpjreva/valida.asp', $params, $headers);
$crawler = new Crawler($data['response']);
if(strpos($crawler->html(), '<b>Erro na Consulta</b>') !== false){
throw new \RuntimeException('Erro ao consultar. Confira se você digitou corretamente os caracteres fornecidos na imagem.', 98);
Expand Down Expand Up @@ -168,4 +168,4 @@ private static function request($uri, array $data = [], array $headers = []){
$response = substr($response, $size);
return compact('response', 'headers');
}
}
}

0 comments on commit 5d18b33

Please sign in to comment.