-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTopMcList-lib.php
More file actions
38 lines (38 loc) · 1.33 KB
/
TopMcList-lib.php
File metadata and controls
38 lines (38 loc) · 1.33 KB
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
<?php
// author DCreason
// This is a php library for quick requests to the TopMcList api.
class Topmclist{
public function __construct($key){
if(isset($key)){
$this->apikey = $key;
} else {
$this->apikey = "";
}
}
public function setapikey($key){
$this->apikey = $key;
}
public function getkey(){
return $this->apikey;
}
public function gettotal(){
$array = json_decode(file_get_contents("https://topmclist.com/API?Key=".$this->apikey."&Type=Get_Total"), true);
return $array["data"]["servers"];
}
public function getvotes($address){
$array = json_decode(file_get_contents("https://topmclist.com/API?Key=".$this->apikey."&Type=Get_Votes&Address=".$address), true);
return $array["data"];
}
public function getrank($address){
$array = json_decode(file_get_contents("https://topmclist.com/API?Key=".$this->apikey."&Type=Get_Rank&Address=".$address), true);
return $array["data"]["rank"];
}
public function getserverbyrank($rank){
$array = json_decode(file_get_contents("https://topmclist.com/API?Key=".$this->apikey."&Type=Get_Server_By_Rank&Rank=".$rank), true);
return $array["data"]["name"];
}
public function getgraph($address, $limit){
return file_get_contents("http://topmclist.com/API?Key=".$this->apikey."&Type=Get_Graph&Address=".$address."&Limit=".$limit);
}
}
?>