-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathviewer.php
36 lines (30 loc) · 852 Bytes
/
viewer.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
<?php
if (!isset($_GET['fileName'])) {
$files = scandir('output');
foreach($files as $file) {
if ($file != "." && $file != "..") {
$file = basename($file, '.json');
?>
<a href="?fileName=<?= $file ?>"><?= $file ?></a><br>
<?php
}
}
exit;
}
$fileName = $_GET['fileName'];
$content = file_get_contents("output/$fileName.json");
$cars = json_decode($content);
?>
<ul>
<?php foreach ($cars as $car): ?>
<li>
<a href="http://avito.ru<?= $car->url ?>">link</a>
<?php if (isset($car->photo)): ?>
<img src="<?= $car->photo ?>">
<?php endif; ?>
<?php if (isset($car->price)): ?>
<span><?= $car->price ?></span>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>