<?php
if (file_exists(getcwd()."/cookie.txt")) {
unlink(getcwd()."/cookie.txt");
}
function getStr($string, $inicio, $fim, $n=1){
$string = explode($inicio, $string);
$string = explode($fim, $string[$n]);
return $string[0];
}
function Dados(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.4devs.com.br/ferramentas_online.php');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Host: www.4devs.com.br',
'Accept: application/json, text/javascript, */*; q=0.01',
'Connection: keep-alive',
'Content-Type: application/x-www-form-urlencoded; charset=UTF-8',
'Referer: https://www.4devs.com.br/gerador_de_pessoas',
'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'acao=gerar_pessoa&sexo=H&idade=22&pontuacao=S&cep_estado=&cep_cidade=');
$resposta = curl_exec($ch);
return $resposta;
}
#$cpf = $_GET['cpf'];
$dados = Dados();
$dados = json_decode($dados, true);
$cpf2 = $dados['cpf'];
$cpf = str_replace('.', '', $cpf2);
$cpf = str_replace('-', '', $cpf);
$rand = rand(10000, 99999);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.fab.faixa-azul.net.br/api/user/new');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, 1);
#curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Host: api.fab.faixa-azul.net.br',
'Connection: keep-alive',
'Accept: application/json, text/plain, */*',
'Origin: http://localhost',
'Authorization: Bearer null',
'User-Agent: Mozilla/5.0 (Linux; Android 5.1.1; G011A Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.100 Safari/537.36',
'Content-Type: application/json',
'Referer: http://localhost/',
'Accept-Language: pt-BR,en-US;q=0.8',
'X-Requested-With: com.fabriciano.zonaazuldigital'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"UserDocument":"'.$cpf.'","UserName":"Elisiane De Quadros Pelmeiro","UserBirthDate":"1982-'.rand(10, 12).'-'.rand(10, 28).'","UserPhoneArea":"'.rand(10, 99).'","UserPhoneNumber":"98102'.rand(1000, 9999).'","UserEmail":"juju2'.rand(1000, 9999999999).'@gmail.com","UserPassword":"sakaki123","UserAcceptTerm":true,"UserEmailSend":false,"ConcessionaryId":6}');
$resposta = curl_exec($ch);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://api.fab.faixa-azul.net.br/token');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_COOKIE, 1);
#curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Host: api.fab.faixa-azul.net.br',
'Connection: keep-alive',
'Accept: application/json, text/plain, */*',
'Origin: http://localhost',
'Authorization: Bearer null',
'User-Agent: Mozilla/5.0 (Linux; Android 5.1.1; G011A Build/LMY48Z; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.100 Safari/537.36',
'Content-Type: application/json',
'Referer: http://localhost/',
'Accept-Language: pt-BR,en-US;q=0.8',
'X-Requested-With: com.fabriciano.zonaazuldigital'));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'username='.$cpf.'&password=sakaki123&grant_type=password');
$resposta = curl_exec($ch);
echo $resposta;
echo $cpf;
$codigo = getStr($resposta, 'access_token":"', '"');
$abrir = fopen(getcwd()."/chave.txt", 'w');
fwrite($abrir, $codigo);
?>