Navigate with Curl after executing login

0

Good morning, I'm trying, after logging into a website, to extract some information, however, after logging into the site, I need to send a new post to select the data. The problem is that in this second request the screen goes blank. I already put a condition with curl_error ($ ch), but it does not return any error, so not what could be wrong. Can anyone help me with this? The code I'm using is this:

$arquivo = __DIR__ . DIRECTORY_SEPARATOR . md5(rand().time());
file_put_contents($arquivo, '');



    $ch = curl_init();
    $url = "https://sistemas.anatel.gov.br/sis/cadastrosimplificado/pages/acesso/login.xhtml?i=0&codSistema=649";

    
    // CONFIGURANDO A URL
    curl_setopt($ch, CURLOPT_URL, $url); //DEFINE A URL PARA ACESSAR
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_POST, 1);
	curl_setopt($ch, CURLOPT_POSTFIELDS, 'SISLogin=********&SISSenha=********&SISQSmodulo=*****');
	curl_setopt($ch, CURLOPT_COOKIEJAR, $arquivo);
	curl_setopt ($ch, CURLOPT_REFERER, $url);
    
    
    // EXECUTANDO A SESSÃO COM UTF-8
    $resultado = curl_exec($ch);

	curl_setopt($ch, CURLOPT_URL, 'http://focus.anatel.gov.br/focus/Tratar_Solicitacao/pesquisa.asp?SISQSmodulo=13863');
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
	curl_setopt($ch, CURLOPT_POST, 1);
    $dados = 'txtResponsavel=&txtTipoAtendimento=Todos&txtServico=Todos&txtModalidade=Todos&txtMotivo=Todos&txtSubMotivo=Todos&txtCategoria=Todos&txtSubCategoria=Todos&txtSituacao=Todas&txtAcao=Todos&optReiterada=&codIdtArvoreVinculo=&chkTpPesquisa=on&cmbHolding=&txtHolding=&cmbPrestadora=&txtPrestadora=&cmbRespPrest=&txtRespPrest=&cmbPrestReclamada=+&cmbSuperintendencia=&txtSuperintendencia=&cmbRespOrg=&txtRespOrg=&cmbTipoAtendimento=&cmbSituacao=-1&cmbAcao=+&dtInicio=04%2F10%2F2018&dtFim=04%2F10%2F2018&chkConcluidaPeriodo=&optConcluidaPeriodo=on&optIndReiteracao=on&cmbCanalEntrada=+&indAlterarDiagnostico=&optAReclassificar=on&txtTpCliente=Todos&cmbTpCliente=+&txtOrgaoPublico=Todos&cmbOrgaoPublico=+&txtNomeCliente=&txtCPFCliente=&txtCNPJCliente=&txtTelProblema=&cmbUFCliente=+&chkSolicitacao=on&chkDtRegistro=on&chkServico=on&chkSituacao=on&chkCliente=on';
    curl_setopt($ch, CURLOPT_POSTFIELDS, $dados);
    curl_setopt($ch, CURLOPT_COOKIEJAR, $arquivo);
    curl_setopt($ch, CURLOPT_COOKIEFILE, $arquivo);


	$content = curl_exec($ch);

	curl_setopt($ch, CURLOPT_URL, 'http://focus.anatel.gov.br/FOCUS/TRATAR_SOLICITACAO/ListagemAvancada.asp');

	$final = curl_exec($ch);

    echo $final;

    // FECHAMENTO DA SESSÃO CURL
    curl_close($ch);
    
asked by anonymous 04.10.2018 / 17:50

0 answers