-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.php
More file actions
45 lines (26 loc) · 747 Bytes
/
api.php
File metadata and controls
45 lines (26 loc) · 747 Bytes
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
<?php
include "./config.php";
class Avatar{
const JSON = URL;
function __construct(){
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, self::JSON);
$data=curl_exec($ch);
curl_close($ch);
$obj = json_decode($data);
$this->obj = $obj;
}
function show__avatar(){
if (!empty($this->obj->{"API-Key"}->uuid)) {
$avatar = "<img src=\"". $this->obj->avatar->src ."\" alt=\"".$this->obj->avatar->title."\" title=\"".$this->obj->avatar->title."\">";
return $avatar;
} else {
echo "Keine API-Key vorhanden.";
}
}
}
$img = new Avatar();
echo $img->show__avatar();
?>