Skip to content

Commit

Permalink
Ajuste na coleta do cookie
Browse files Browse the repository at this point in the history
resolvendo problema, resolve #10
  • Loading branch information
Isael Sousa Santos committed Jan 17, 2017
1 parent a6db1d9 commit c369fb9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/CpfGratis.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ class CpfGratis {
public static function getParams()
{
$client = new Client();

$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_SSL_VERIFYPEER, false);
$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_SSL_VERIFYHOST, false);
$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_SSLVERSION, 3);

$client->request('GET', 'https://www.receita.fazenda.gov.br/Aplicacoes/SSL/ATCTA/CPF/ConsultaPublica.asp');

$headers = $client->getResponse()->getHeaders();
$cookie = $headers['Set-Cookie'][0];
$internal_cookies = $client->getCookieJar()->all()[0];
$cookie = $internal_cookies->getName().'='.$internal_cookies->getValue(). '; path='. $internal_cookies->getPath();

$client->getClient()->setDefaultOption('config/curl/'.CURLOPT_BINARYTRANSFER, true);
$client->request('GET', 'https://www.receita.fazenda.gov.br/Aplicacoes/SSL/ATCTA/CPF/captcha/gerarCaptcha.asp');
Expand Down

0 comments on commit c369fb9

Please sign in to comment.