<?php
$dni = $_POST['dni'];
$arrContextOptions=array(
    "ssl"=>array(
        "verify_peer"=>false,
        "verify_peer_name"=>false,
    ),
);  
$data = file_get_contents("https://api.ludfact.com/Consulta/DNI?numDoc=".$dni,false, stream_context_create($arrContextOptions));
$info = json_decode($data, true);
 
if($data==='[]' || $info['Nombres']===''){
	$datos = array(0 => 'nada');
	echo json_encode($datos);
}else{
$datos = array(
	0 => $dni, 
	1 => '',
	2 => $info['APaterno'],
	3 => $info['AMaterno'],
	4 => $info['Nombres']
	);
	echo json_encode($datos);
} 
  
 
?>