Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
2.3 kB
5
Indexable
Never
<form method="post">

<br>
<br>

    <center><input name="buscarcpf" type="textarea" placeholder="Digite o seu CPF"><br>
    <button type="submit" name="enviar">Enviar</button></center>
     
</form>

<?php

function getStr($string, $start, $end) {
    $str = explode($start, $string);
    $str = explode($end, $str[1]);
   return $str[0];
  }
@$cpf = $_POST['buscarcpf'];

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://ssl.datanext.com.br/sistema-datasys/rest/ecommerce/1053//api/out/consulta_cadsus_get?id_cooperativa=1049&cpf='.$cpf.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
    'accept: application/json, text/javascript, /; q=0.01',
    'accept-encoding: gzip, deflate, br',
    'accept-language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7',
    'authorization: Basic ZWNvbWVyY2U6ZWNvbWVyY2VAZGF0YXN5cw==',
    'referer: https://ssl.datanext.com.br/sistema-datasys/mod-ecom/1049/',
    'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Cbrome/91.0.4472.106 Safari/537.36',
    'x-requested-with: XMLHttpRequest'));
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd().'/luquete.txt');
 $resultado = curl_exec($ch);
    $nome = getstr($resultado, '"Nome":"','"');
    $pai = getstr($resultado, '"Pai":"','"');
    $mae = getstr($resultado, '"Mae":"','"');
    $cns = getstr($resultado, '"CNS":"','"');
    $nascimento = getstr($resultado, '"DataNascimento":"','"');
    if (strpos($resultado, 'http_status_cod":200,')) {
        echo "<center><h2>_Resultado_</h2></center>";
        echo "<center><br>";
        echo "<center>CNS: $cns</center>";
        echo "<center><br>";
        echo "<center>Nome: $nome</center>";        
        echo "<center><br>";
        echo "<center>CPF: $cpf";
        echo "<center><br>";
        echo "<center>Data: $nascimento</center>";
        echo "<center><br>";
        echo "<center>Pai: $pai</center>";
        echo "<center><br>";
        echo "<center>Mãe: $mae</center>";
   

    }
    elseif (strpos($resultado, '"http_status_cod":400')){
        echo "CPF INCORRETO / INEXISTENTE";
    }
    else {
        echo "DIGITE O CPF CORRETAMENTE!";
    }
?>