Documentation API
English
The player votes on our website, and our platform automatically reports the vote to your game server so you can reward them.
Verification by tokenSecuredAutomaticBetter performance
Callback URL
Script called after each vote
On your game server's “API” page, choose the Vote Token API and enter the address of your script. In these examples, api-vote is the name of the script:
https://example.com/api-vote.php
https://example.com/api-vote/
Voting URL
Link to place on your website
Your player's voting link must contain the ID of your game server and a custom token of your player's account (For example, their account ID):
https://beta.top-metin2.org/in/{id}-{name}/{token}/
- {id} ID of your game server, for example
42 - {name} server name in the address of its page, for example
my-server - {token} your player's token (Lowercase letters and digits)
API
Script on your website
You must create a new file, specific to our API for your website, this script must not be in a secure area and must be freely accessible so that our platform can call it after a vote. Our API allows you to reward your player for having made a vote for your game server within our platform, for this you must adapt and add the script of your reward.
<?php
// Secret key of your game server
define('GAME_KEY', 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx');
// Data Verification
if (!isset($_GET['miaw']) && empty($_GET['miaw'])) {
// The request is incomplete
die('GET method is not defined');
} else {
// Data decoding
$_API = json_decode(base64_decode($_GET['miaw']), true, 2, JSON_OBJECT_AS_ARRAY);
// $_API['api'] => URL of your local API
// $_API['key'] => Secret key of your game server
// $_API['origin'] => Origin of the vote
// $_API['status'] => Vote status on Top Metin2
// $_API['timestamp'] => Date and time of the vote (UTC)
// $_API['ip'] => Your player's IPv4 or IPv6 address (Can be NULL)
// $_API['ipv4'] => Your player's IPv4 address (Can be NULL)
// $_API['token'] => Your player's account token
if ($_API['key'] == GAME_KEY) {
// You can reward your player
// Identify your player using $_API['token']
} else {
// The secret keys are not identical
// The request is probably falsified
die('Keys do not match');
}
}
?>