-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_lite.php
27 lines (23 loc) · 888 Bytes
/
api_lite.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
<?php
// Do not edit below this line.
$ver = "1.0.1";
header('Access-Control-Allow-Origin: *');
function fixUrl($url) {
$url = rawurldecode($url);
return $url;
}
if(isset($_GET["dl"])) {
$dl = fixUrl(htmlspecialchars($_GET["dl"]));
} else {
$dl = "";
}
function deJson($url) {
return json_decode(file_get_contents($url), true);
}
if(strpos($dl, "duckduckgo.com") ==! false) {
header('Content-Type: application/json; charset=utf-8');
echo json_encode(deJson(str_replace(' ' ,'%20',$dl)), JSON_PRETTY_PRINT);
} else {
echo "<title>Error 404</title><center style='margin-top:36vh;font-family:\"PT Sans Caption\",Helvetica,sans-serif'><h1>error 404</h1><b>The endpoint you were trying to find was not found.</b><br><p style='color:grey;'>Casa ".$ver."</p></center>";
}
?>