Validace adres CZ/SK/PL
Ukázka PHP kódu:
<?php
$data = array(
'municipalityName' => 'Praha',
'co' => '4',
'street' => 'Česákova',
);
$url = "http://localhost:8123/api/v1/ruian/validate?" . http_build_query($data);
echo $url . "\n";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, false);
$data = curl_exec($curl);
curl_close($curl);
echo json_encode(json_decode($data), JSON_PRETTY_PRINT);
Ukázka výstupu:
{
"status": "POSSIBLE",
"message": null,
"place": {
"confidence": 0.9801,
"regionId": "CZ010",
"regionName": "Hlavn\u00ed m\u011bsto Praha",
"municipalityId": 554782,
"municipalityName": "Praha",
"streetName": "\u010ces\u00e1kova",
"ce": null,
"cp": "425",
"co": "4",
"zip": 18200,
"id": 22395202
}
}