-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
106 lines (82 loc) · 3.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>Document</title>
<style>
.FINISHED{
background:red;
}
.IN_PLAY{
background:green;
}
.TIMED{
background:Blue;
}
</style>
</head>
<body>
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.football-data.org/v4/competitions/WC/matches',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'X-Auth-Token: b7d91565ae9d4069af402074cabb6ba3'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo '<script>var json ='.$response .
'</script>' ;
?>
<div class="nav w-full h-52 flex place-content-center place-items-center aboslute left-0 ">
<img src="qatar-word.png" class="w-2/4 h-auto" alt="">
<img src="logo.png" alt="" class="w-20 h-auto">
</div>
<div id="insert" class="nav w-full flex place-content-center place-items-center aboslute left-0 flex-col">
</div>
</body>
<script>
var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var insert = document.getElementById("insert");
var t = ``;
if(json)
{
for(var key in json['matches']){
console.log(json['matches'][key]["awayTeam"]["crest"])
t+= `<div class="w-3/4 h-20 bg-slate-800 rounded-lg shadow-lg drop-shadow-lg pointer flex justify-between items-center text-white mt-5"> <div class="away w-2/6 h-full flex justify-center items-center" ><div class="logo relative flex justify-center items-center hidden md:block">`
t+= `<img src="${json['matches'][key]["awayTeam"]["crest"]}" class="w-20 rounded-lg" alt=""></div> <span class="w-5 hidden md:block"></span> <div class="name flex justify-center items-center font-bold">${json['matches'][key]["awayTeam"]["name"]}</div></div>`
if(json['matches'][key]["score"]["fullTime"]["away"]==null)
{
var x = json['matches'][key]["utcDate"].substr(8,2)
if(x == dd){
t+= `<div class="status text-2xl font-bold w-2/6 h-full flex justify-center items-center bg-green-600">`
t += json['matches'][key]["utcDate"].substr(11,5)
t += ` (GMT)`
}
else{
t+= `<div class="status text-xl font-bold w-2/6 h-full flex justify-center items-center ${json['matches'][key]["status"]}">`
t += json['matches'][key]["utcDate"].substr(0, 10)
}
}
else{
t+= `<div class="status text-2xl font-bold w-2/6 h-full flex justify-center items-center ${json['matches'][key]["status"]}">`
t+=`${json['matches'][key]["score"]["fullTime"]["away"]} : ${json['matches'][key]["score"]["fullTime"]["home"]}`
}
t+= `</div><div class="home w-2/6 h-full flex justify-center items-center"><div class="name flex justify-center items-center font-bold">${json['matches'][key]["homeTeam"]["name"]}</div><span class="w-5 hidden md:block"></span><div class="logo relative hidden md:block flex justify-center items-center"><img src="${json['matches'][key]["homeTeam"]["crest"]}" class="w-20 rounded-lg" alt=""></div></div></div>`
}
insert.innerHTML = t;
}
</script>
</html>