PHP code example of jossmp / reniec

1. Go to this page and download the library: Download jossmp/reniec 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/ */

    

jossmp / reniec example snippets

sh

    
sh

	 new \jossmp\jne\rop(); // Registro de Organicaciones Politicas
	$essalud = new \jossmp\essalud\asegurado();
	$servir = new \jossmp\servir\servir();
	//$mtc = new \jossmp\mtc\conductor(); //Miniterio de trasporte y comunicaciones

	$dni = "44274795";

    $search1 = $rop->consulta( $dni );
	$search2 = $essalud->consulta( $dni );
	$search3 = $servir->consulta( $dni );

    if( $search1->success == true )
	{
		echo "Hola: " . $search1->result->nombres;
	}

	if( $search2->success == true )
	{
		echo "Hola: " . $search2->result->nombre;
	}

	if( $search2->success == true )
	{
		echo "Hola: " . $search3->result->nombre;
	}
sh
{
    "success": true,
    "result": {
        "dni": "44274795",
        "verificacion": 0,
        "paterno": "MAZCO",
        "materno": "PUMA",
        "nombre": "JOSUE",
        "sexo": "Masculino",
        "nacimiento": "22/**/****",
        "gvotacion": null
    },
    "asegurado": null
}
sh

	...
	if( $search->success == true )
	{
		echo $search->json( );
		echo $search->json( 'callback_js' );
	}

	if( $search->success == true )
	{
		echo PHP_EOL . $search->xml( );
		echo PHP_EOL . $search->xml( 'persona' ); // define nodo raiz
	}