/
malappinfo.php
39 lines (39 loc) · 1.01 KB
/
malappinfo.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
<?php
//Created by FoxInFlame - https://github.com/FoxInFlame/matomari
header("Content-Type: text/xml");
header("access-control-allow-origin: *");
// Global Variables (and their defaults).
$username;
$type = "anime";
$status = "all";
// Check for username
if(!isset($_GET["u"]) || empty($_GET["u"])){
echo "<myanimelist/>";
exit();
}else{
$username = $_GET["u"];
}
// Check for type
if(isset($_GET["type"]) && !empty($_GET["type"])) {
// I really love switch/case
switch($_GET["type"]) {
case "anime":
$type = "anime";
break;
case "manga":
$type = "manga";
break;
default:
$type = "anime";
}
}
// Check for status
if(isset($_GET["status"]) && !empty($_GET["status"])) {
$status = $_GET["status"];
}
// cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://myanimelist.net/malappinfo.php?u=".$username."&type=".$type."&status=".$status); // Set the URL
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); // Return the content
echo curl_exec($curl); // Execute the request, and show the response
?>