S
S
sgidlev2018-05-22 15:13:15
PHP
sgidlev, 2018-05-22 15:13:15

How to connect to the Crown API service and get a response from it with parameters?

Hello!
Please help to connect with the Crown API service and get a response from it with parameters.

function api_korona_connect($api_url)
        {
            $connection_c = curl_init(); // initializing
            curl_setopt($connection_c, CURLOPT_URL, $api_url); // API URL to connect
            curl_setopt($connection_c, CURLOPT_RETURNTRANSFER, 1); // return the result, do not print
            curl_setopt($connection_c, CURLOPT_TIMEOUT, 30);
            $json_return = curl_exec($connection_c); // connect and get json data
            ob_start();
            print_r($json_return);
            curl_close($connection_c); // close connection
            return json_decode($json_return);
            // decode and return
        }
        $PimsCreateURL = 'https://ias.demo.korona.net/pims/v2/pims-create';    //URL для API PIMS-CREATE
        $CdasURL = 'https://ias.demo.korona.net/cdas/v3x';    //URL для API CDAS
        $netId = 323269;    //Идентификатор сети в ПЦ
        $connectTimeout = 5;//Таймаут на подключение для всех API
        $sendRecvTimeout = 30;    //Таймаут на ожидание ответа для всех API
        $certFilePath = '../certs/NET323269.pem';    //Файл с открытым и закрытым ключем для всех API
        $CAFilePath = './certs/CA.pem';    //Файл корневых сертфикатов для всех API
        $return = api_korona_connect('https://ias.demo.korona.net//cdas/v3?pan=7780000000000001&net=5555&tx_history=2');

Probably you need to somehow transfer the certificates in the request, but I do not know how this is done.
Excerpts from the documentation:
Parameters are passed in the body of the POST request to exclude the possibility of "settling" confidential
information in the logs of intermediary servers.
Access is via a secure connection (HTTPS with mutual authentication). To gain access
, a class 5 certificate is required.
Access point (URL): Provided by maintainers.
Interaction with API - services
In personal account scenarios, you will need to use the following API - services:
Scenario Calls to API - services Comment on usage
Registering a client in the CDAS v3x personal account To check the existence of a card and a
PIMS-CREATE questionnaire To create a client profile
Viewing information on a CDAS v3x card Obtaining information on the state of the bonus balance
Related documentation
On the pages in Confluence:
CDAS/v3x - a page with a description and specifications of CDAS;
Creating a new questionnaire (PIMS-create) - a page with a description and specifications of the PIMS service;
Settings for interacting with API-services
The method of storing settings is at the discretion of developers, the table below shows:
Parameter name in configuration Parameter description Comment
PimsCreateURL https://ias.demo.korona.net/pims/v2/pims-create URL for API PIMS- CREATE
CdasURL https://ias.demo.korona.net/cdas/v3x URL for CDAS API netId
323269 Network ID in PC
connectTimeout 5 Connection timeout for all APIs
sendRecvTimeout 30 Timeout for waiting for response for all APIs
certFilePath ../certs/NET323269 .pem Public and private key file for all CAFilePath APIs
./certs/CA.pem Root certificate file for all APIs
Note:
The table is populated with test environment values.
Example POST
request
/cdas/v3?pan=7780000000000001&net=5555&tx_history=2 HTTP/1.1
Content-Length: XX
Content-Type:text/xml
or
POST request parameters:
pan=7780001534339774&FIRST_NAME=Ivan&LAST_NAME=Grozny&MOBILE_PHONE=79165555555&BIRTH_DATE=15300825&GENDER=1&CITY=MOSCOW&&[email protected]&GENDER=1&HOUSE_NO=44&PATRONYMIC_NAME=Vasilverskaya

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2018-05-22
@SilenceOfWinter

with such requests, look for a freelance artist or adapt plugins from other cms.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question