Answer the question
In order to leave comments, you need to log in
How to parse an array received via API?
Hello!
We have a form that collects data and sends it via API to a third-party resource, in response we receive information in JSON format.
Array ( [response] => Array ( [items] => Array ( [0] => Array ( [gosnumber] => B170OP29 [mark] => VAZ 211540 [category] => B (M1) [vin] => XTA21154084560272 [data_diagnostic] => 2017-05-19 [sroc_deistvia] => 2018-05-18 [
number_eaisto ] =>
082200051702444 ) ) ) ) : V170OR29
Brand: VAZ 211540
Category: B (M1)
VIN: XTA21154084560272
Diagnostic date: 2017-05-19
Validity: 2018-05-18 EAISTO
number: 082200051702444
Code,
$url = $url_get_kbm2."?".http_build_query($arr_post_out);
$out_txt = file_get_contents($url);
$data = json_decode($out_txt,true);
print_r($data);
Answer the question
In order to leave comments, you need to log in
$url = $url_get_kbm2."?".http_build_query($arr_post_out);
$out_txt = file_get_contents($url);
$data = json_decode($out_txt,true);
foreach($data['response']['items'] as $val) {
echo 'Госномер: '.$val['gosnumber'].' / Марка: '.$val['mark'];
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question