forked from opennodedb/php-as-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest1.php
55 lines (49 loc) · 1.25 KB
/
test1.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
require_once('vendor/autoload.php');
require_once('include/config.php');
require_once('ASAPI.php');
$asapi = new ASAPI([
'username' => $username,
'password' => $password,
]);
$nodes = $asapi->call('nodes?b');
$nodedata = [];
$i = 0;
foreach($nodes as $node) {
//echo $i . " " . $node['id'] . " " . $node['name'] . "\n";
if(isset($node['id'])) {
$nodedetails = $asapi->call('nodes/' . $node['id']);
$nodedata[$node['id']] = [
'id' => $node['id'],
'name' => $node['name'],
'lat' => $node['lat'],
'lng' => $node['lng'],
'elev' => $nodedetails['elevation'],
'as' => $nodedetails['asNum'],
];
}
$i++;
}
?>
<html>
<table>
<tr>
<th>ID</th>
<th>Name</th>
<th>Lat</th>
<th>Lng</th>
<th>Elevation</th>
<th>AS</th>
</tr>
<?php foreach($nodedata as $node) { ?>
<tr>
<td><?= $node['id'] ?></td>
<td><?= $node['name'] ?></td>
<td><?= $node['lat'] ?></td>
<td><?= $node['lng'] ?></td>
<td><?= $node['elev'] ?></td>
<td><?= $node['as'] ?></td>
<tr>
<?php } ?>
</table>
</html>