Documentation
EnglishVote IP
The player votes on our platform and you can thus reward him at the end of this vote. For this, your player must go to your website to trigger the call to our API. The response from our API is a JSON array.
- Allows you to verify a vote using an IP address
- API compatible with IPv4 and IPv6 protocol
Voting URL
You must define within your website, a voting link for your player. This link must imperatively contain the ID of your game server.
- Example : https://top-metin2.org/in/game-id-game-seo-name/
API
Route
https://top-metin2.org/api/verify/key/ip/
Settings
Field | Type | Description |
key | string | Secret key to your game server |
ip | string | IP address of your player |
Responses
Status | Header | Response | Data | Timestamp |
true | 200 | Player has voted - Verified vote | Date and time of the vote in datetime format (UTC+0) | Object |
false | 101 | IP address is invalid | NULL | NULL |
false | 102 | IP address or ASN is not safe | NULL | NULL |
false | 103 | API Key does not exist | NULL | NULL |
false | 104 | Wrong API Called | NULL | NULL |
false | 105 | Game server banned | NULL | NULL |
false | 106 | Game server disabled | NULL | NULL |
false | 107 | Vote has already been verified by our API | Date and time of the vote in datetime format (UTC+0) | Object |
false | 108 | Player vote does not exist | NULL | NULL |
Our API has two main statuses:
- Bool (true) ⇒ The vote has been verified, you can reward your player
- Bool (false) ⇒ An error occurred while checking the vote
Example
HTTP/1.1 200 OK
{
"status" => true,
"header" => 200,
"response" => "Player has voted - Verified vote",
"data" => "31-12-9999 23:59:59",
"timestamp" => {
"next_vote" => 1711204824,
"current_vote" => 1711199424,
"delay_vote" => 2504
}
}
PHP Example
You need to install our API script on one of your pages on your website. It must be installed on a secure area, that is to say, a page where your player must be connected to your website to consult and access said page. Our API allows you to reward your player for having voted for your game server within our platform, for this you must adapt and add the script of your reward.
<?php
$key = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx";
// Secret key of your game server
$ip = isset($_SERVER["HTTP_CF_CONNECTING_IP"]) ? $_SERVER["HTTP_CF_CONNECTING_IP"] : $_SERVER['REMOTE_ADDR'];
// Get your player's IP address
$api = "https://top-metin2.org/api/verify/{$key}/{$ip}/";
// Route
$response = @file_get_contents($api);
// API Call
$vote = json_decode($response);
// Response decoding
if ($vote->status){
// Vote OK
// You can donate virtual currencies
} else {
// [OR] The vote has already been verified
// [OR] No votes were found
// [OR] An error has occurred
}
?>