-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
106 lines (92 loc) · 1.84 KB
/
index.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
require('functions.php');
$GSMArena = gsmarena('https://www.gsmarena.com/samsung_galaxy_a71-9995.php');
$GSMArenaToArray = json_decode($GSMArena,TRUE);
?>
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
div.gallery {
border: 1px solid #ccc;
}
div.gallery:hover {
border: 1px solid #777;
}
div.gallery img {
width: 100%;
height: auto;
}
div.desc {
padding: 15px;
text-align: center;
}
* {
box-sizing: border-box;
}
.responsive {
padding: 0 6px;
float: left;
width: 24.99999%;
}
@media only screen and (max-width: 700px) {
.responsive {
width: 49.99999%;
margin: 6px 0;
}
}
@media only screen and (max-width: 500px) {
.responsive {
width: 100%;
}
}
.clearfix:after {
content: "";
display: table;
clear: both;
}
</style>
</head>
<body>
<h1>JSON Example:</h1> <?=$GSMArena ?>
<h1>HTML Table Example:</h1>
<?php foreach($GSMArenaToArray['table'] as $key => $value): ?>
<table cellspacing="0">
<tr>
<th rowspan="10" scope="row"><?= $key ?></th>
</tr>
<?php
for($i=0;$i<count($GSMArenaToArray['table'][$key][0]);$i++){
echo '<tr>
<td>'.$GSMArenaToArray['table'][$key][0][$i].'</a></td>
<td>'.$GSMArenaToArray['table'][$key][1][$i].'</td>
</tr>';
}
echo "<hr>";
?>
</table>
<?php endforeach ?>
<h1>Images Example:</h1>
<?php foreach($GSMArenaToArray['images'] as $key => $value): ?>
<div class="responsive">
<div class="gallery">
<img src="<?=$value?>" alt="Example" width="600" height="400">
<div class="desc">Add a description of the image here</div>
</div>
</div>
<?php endforeach ?>
</body>
</html>