catalogTTList.php
1.21 KB
1
2
3
4
5
6
7
8
9
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
<?php
require_once 'config.php';
function catalogTTList(){
$urls = [
"catalog" => file_get_contents(webAlias.'/php/rest/getCatalogsList.php'),
"timeTable" => file_get_contents(webAlias.'/php/rest/getTimeTablesList.php')
];
$parameters = [];
foreach ($urls as $key => $url){
$xml = simplexml_load_string(file_get_contents($url));
if (empty($xml))
continue;
foreach($xml->xpath('//'.$key) as $parameter) {
$attributes = $parameter->attributes();
$parameters[] = [
"type" => $key,
"name" => (string) $attributes->name,
"id" => (string) $attributes->id,
"created" => (string) $attributes->created,
"description" => (string) $attributes->description,
"nbIntervals" => (string) $attributes->nbIntervals,
"surveyStart" => (string) $attributes->surveyStart,
"surveyStop" => (string) $attributes->surveyStop,
"sharedDate" => (string) $attributes->sharedDate
];
}
}
return json_encode($parameters);
}
echo catalogTTList();
?>