PHP code example of jdelta / consultar-sunat
1. Go to this page and download the library: Download jdelta/consultar-sunat library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jdelta / consultar-sunat example snippets
use ConsultarSunat\SearchService;
$service = new SearchService();
$ruc = "20169004359";
$dni = "44274795";
$result1 = $service->search($ruc);
$result2 = $service->search($dni);
var_dump($result1);
var_dump($result2);
if ($result1->success == true) {
echo "Empresa: " . $result1->result->RazonSocial;
}
if ($result2->success == true) {
echo "Persona: " . $result1->result->RazonSocial;
}
// Mostrar en formato XML/JSON
echo $result1->json();
echo $result1->xml('empresa');