PHP code example of apihub-cdc / rcc-pm-simulacion-client

1. Go to this page and download the library: Download apihub-cdc/rcc-pm-simulacion-client 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/ */

    

apihub-cdc / rcc-pm-simulacion-client example snippets


public function setUp()
{
    $config = new Configuration();
    $config->setHost('the_url');
    $this->x_api_key = "your_x_api_key";
    $client = new Client();
    $this->apiInstance = new Instance($client,$config);
}

/**
* Este método será ejecutado en la prueba ubicado en path/to/repository/test/Api/ApiTest.php
*/
public function testGetReporteCreditoPM()
{
    try {

        $request = new PersonaPeticion();
        $persona = new Persona();
        $domicilio = new PersonaDomicilio(); 
        $catalogoEstados = new CatalogoEstados(); 
        $catalogoPais = new CatalogoPais();            

        $domicilio->setDireccion("AV. PASEO DE LA REFORMA 01");
        $domicilio->setColoniaPoblacion("GUERRERO");
        $domicilio->setDelegacionMunicipio("CUAUHTEMOC");
        $domicilio->setCiudad("CIUDAD DE MÉXICO");
        $domicilio->setEstado($catalogoEstados::DF);
        $domicilio->setCP("68370");
        $domicilio->setPais($catalogoPais::MX);

        $persona->setRFC("EDC930121E01");
        $persona->setNombre("RESTAURANTE SA DE CV");
        $persona->setDomicilio($domicilio);

        $request->setFolioOtorgante("1000001");
        $request->setPersona($persona);

        $result = $this->apiInstance->getReporteCreditoPM($this->x_api_key, $request);
        print_r($result);
    } catch (ApiException | Exception $e) {
        echo 'Exception when calling ApiTest->testGetReporteCreditoPM: ', $e->getMessage(), PHP_EOL;
    }        
}
sh
#ejemplo con php en versión 7.3 para otra versión colocar php{version}-curl
apt-get install php7.3-curl
apt-get install php7.3-mbstring