Untitled
unknown
php
3 years ago
1.4 kB
10
Indexable
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://nekos.life/api/v2/img/neko",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "Error #:" . $err;
} else {
$imgs = json_decode($response);
$image = $imgs->{'url'};
$imageData = base64_encode(file_get_contents($image));
echo '<!DOCTYPE html>
<html lang="en">
<head>
<title>CSS Template</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
}
body {
margin: 0;
font-family: Arial, Helvetica, sans-serif;
}
/* Style the top navigation bar */
.topnav {
overflow: hidden;
background-color: #212121;
padding-left: 10px;
color: white;
}
/* Style the content */
.content {
background-color: #212121;
padding: 5px;
}
</style>
</head>
<body>
<div class="topnav">
<h3>RANDOM ANIME IMAGE</h3>
</div>
<div class="content">
<img src="data:image/jpeg;base64,'.$imageData.'" alt="Anime Image" style="width:100%">
</div>
</body>
</html>';
}
?>Editor is loading...