- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
<?php
public function submit()
{
$requestUri = 'http://127.0.0.1:8000/test/hs/Services/GetShedule';
$response = $this->doPostCall($requestUri . '?' . $this->prepareParams(), null);
$temp_str = json_encode(mb_convert_encoding($response, 'UTF-8'));
$temp_str = str_replace('\ufeff', '', $temp_str);
$temp_str = str_replace('\r', '', $temp_str);
$temp_str = str_replace('\n', '', $temp_str);
$temp_str = str_replace('\"', '"', $temp_str);
$temp_str = mb_strcut($temp_str, 1, -1);
$temp_arr = json_decode($temp_str, true);
$post_main_data = [];
$post_sub_data = [];
foreach($temp_arr as $main_unit_key => $main_unit_value) {
foreach($main_unit_value as $main_unit_feature_key => $main_unit_feature_value) {
foreach ($main_unit_feature_value as $sub_unit_key => $sub_unit_value) {
foreach($sub_unit_value as $sub_unit_feature_key => $sub_unit_feature_value) {
unset($sub_unit_value['Расписание']);
$post_sub_data[$main_unit_key][$main_unit_feature_key][$sub_unit_key] = $sub_unit_value;
}
}
}
}
$raw_data = $temp_arr;
$filter = array('Посты');
$raw_data_length = count($raw_data);
for ($row = 0; $row < $raw_data_length; $row++) {
$post_main_data[] = array_diff_key($raw_data[$row], array_flip($filter));
}
foreach($post_main_data as $pmd_key => $pmd_value) {
$post_main_data[$pmd_key][key($post_sub_data[$pmd_key])] = array_values(array_values($post_sub_data[$pmd_key])[0]);
}
header_remove();
header("Content-Type: application/json");
http_response_code(200);
exit();
}
?>
bot 17.04.2022 12:09 # 0