-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrandomapi.php
127 lines (99 loc) · 2.83 KB
/
randomapi.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api-v3.igdb.com/games",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
// CURLOPT_POSTFIELDS =>"fields name;\nfields platforms;\nwhere rating > 75;\nlimit 15;",
CURLOPT_POSTFIELDS =>"fields *; search \"fifa\"; limit 50;",
CURLOPT_HTTPHEADER => array(
"user-key: b47cf209438a39c664e2ecdef4003048",
"Content-Type: text/plain",
"Cookie: __cfduid=d6d0df9c9cb89cc24006ff91ff243119f1599465272"
),
));
$response = curl_exec($curl);
curl_close($curl);
//echo $response;
echo '<p></p>';
//$result = file_get_contents($curl);
$array = json_decode($response, true);
echo '<p></p>';
echo $array[1]['name'] ;
echo '<p></p>';
echo $array[2]['name'] ;
echo '<p></p>';
echo $array[3]['name'] ;
echo '<p></p>';
echo $array[4]['name'] ;
echo '<p></p>';
echo $array[5]['name'] ;
echo '<p></p>';
echo $array[6]['name'] ;
echo '<p></p>';
echo $array[7]['name'] ;
echo '<p></p>';
echo $array[8]['name'] ;
echo '<p></p>';
echo $array[9]['name'] ;
echo '<p></p>';
echo $array[0]['name'] ;
echo '<p></p>';
?>
<?php
include 'intro.php';
include 'menu.php';
?>
<div class="container">
<div class="row">
<div class="col-4 responsive">
<H2 class="font-weight-bold"><u><?php echo $array[9]['name']; ?></u></H2>
<div>
<img class="m-2 border border-white rounded-lg responsive" src="
<?php
//img from db
echo htmlspecialchars('data:image/jpeg;base64,'.base64_encode( $array[9]['cover'] ));
?>
" alt="
<?php
//nom from db
echo htmlspecialchars($array[9]['cover']);
?>
">
</div>
</div>
<div class="col-8">
<br> <br>
<div class="embed-responsive embed-responsive-16by9">
<iframe class=" border border-white rounded-lg embed-responsive-item " width="" height=""
src="<?php echo $response['id']; ?>"allowfullscreen>
</iframe>
</div>
</div>
</div>
<br>
<div class="row">
<div class="col-4">
<H4 class="font-weight-bold"><u>Genre:</u></h4>
<p><?php echo $jeuinfo['genre']; ?></p>
<H4 class="font-weight-bold"><u>Platforms:</u></h4>
<p ><?php echo $jeuinfo['plateforme']; ?></p>
<H4 class="font-weight-bold"><u>Date:</u></h4>
<p><?php echo $jeuinfo['datesortie']; ?></p>
</div>
<div class="col-8">
<h4 class="font-weight-bold"><u>Synopsis:</u></h4>
<p><?php echo $jeuinfo['synopsis']; ?></p>
</div>
</div>
</div>
<?php
?>
<?php
include 'outro.php';
?>