forked from Maxhar30/Corona-Pakistan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
75 lines (69 loc) · 2.91 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
<?php
$curl = curl_init();
$url = "https://api.covid19api.com/live/country/pakistan/status/confirmed";
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($curl);
if (curl_error($res)) {
echo $res;
} else {
$data = json_decode($res, true);
$arry_size = count($data);
$resp = array_slice($data, -6, 6, true);
$array_sort = array_reverse($resp);
}
curl_close($curl);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
<link href="style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<title>Corona Report</title>
</head>
<body style="background-color: #ECECEC;">
<main class="mt-5 container h-100">
<center>
<h1 style="color:red">Corona Report Pakistan</h1>
</center>
<div class="row mt-5">
<!-- card start -->
<?php
$result = [];
foreach ($array_sort as $key) {
?>
<div class="col-lg-6 col-md-6 col-sm-6">
<div class="card card-stats">
<div class="card-header card-header-danger card-header-icon">
<div class="card-icon">
<h3><?php echo $key['Province']; ?></h3>
</div>
<br>
<br><br><br>
<h3 class="card-title"><span class="card-category">Active Cases :</span> <?php echo $key['Active']; ?></h3>
<hr>
<h3 class="card-title"><span class="card-category">Confirmed :</span> <?php echo $key['Confirmed']; ?></h3>
<hr>
<h3 class="card-title"><span class="card-category">Deaths :</span> <?php echo $key['Deaths']; ?></h3>
<hr>
<h3 class="card-title"><span class="card-category">Recovered :</span> <?php echo $key['Recovered']; ?></h3>
</div>
<div class="card-footer">
Last 24 hours
</div>
</div>
</div>
<!-- card end -->
<?php }
?>
</div>
<main>
<footer>Code by <a href="https://github.com/Maxhar30">Mazhar Hussain</footer>
</body>
</html>