Maak vandaag nog je dromen waar
$merk = []; $handelsbenaming = []; $datum_eerste_toelating = []; $brandstof_omschrijving = []; $cilinderinhoud = []; $eerste_kleur = [];
$nomer = isset($_POST[‘nomer’]) ? $_POST[‘nomer’] : ” “; $nomer = preg_replace( ‘/[^a-zA-Z0-9_*]+/’, ”, $nomer );
$url = ‘https://opendata.rdw.nl/resource/m9d7-ebf2.json?kenteken=’ . urlencode($nomer) . ”; $url_1 = ‘https://opendata.rdw.nl/resource/8ys7-d773.json?kenteken=’ . urlencode($nomer) . ”; $content = file_get_contents($url); $content_1 = file_get_contents($url_1); // $json = json_decode($content, true); if ($content=='{“data”:[],”count”:0}’) //Перевіряємо чи є щось в відповіді { print_r(‘Автомобіль з таким номерним знаком в базі відсутній’); } else { preg_match_all(‘/\”merk”:”(.*?)\”,/’, $content, $merk); //Марка авто $merk_1 = isset($merk[1][0]) ? $merk[1][0] : null; preg_match_all(‘/\”handelsbenaming”:”(.*?)\”,/’, $content, $handelsbenaming); //Модель авто $handelsbenaming_1 = isset($handelsbenaming[1][0]) ? $handelsbenaming[1][0] : null; preg_match_all(‘/\”datum_eerste_toelating”:”(.*?)\”,/’, $content, $datum_eerste_toelating); //Дата першої реєстрації авто $datum_eerste_toelating_1 = isset($datum_eerste_toelating[1][0]) ? $datum_eerste_toelating[1][0] : null; preg_match_all(‘/\”brandstof_omschrijving”:”(.*?)\”,/’, $content_1, $brandstof_omschrijving); //Паливо $brandstof_omschrijving_1 = isset($brandstof_omschrijving[1][0]) ? $brandstof_omschrijving[1][0] : null; preg_match_all(‘/\”cilinderinhoud”:”(.*?)\”,/’, $content, $cilinderinhoud); //Обєм циліндра $cilinderinhoud_1 = isset($cilinderinhoud[1][0]) ? $cilinderinhoud[1][0] : null; preg_match_all(‘/\”eerste_kleur”:”(.*?)\”,/’, $content, $eerste_kleur); //Колір авто $eerste_kleur_1 = isset($eerste_kleur[1][0]) ? $eerste_kleur[1][0] : null;
}
?>
Auto gegevens