Postback
Our postback system notifies your listener every time a player votes for your server, so you can reward them in game automatically.
What is sent
As soon as the vote is counted we send an HTTP POST request (application/x-www-form-urlencoded) with these fields:
| Field | Description |
|---|---|
postback_password | The password you configured for this server |
ip_addr | IP address of the voter |
uid | Our user id of the voter (empty for guests) |
vote_counted | 1 if the vote was counted, otherwise 0 |
server_id | Your server id on MMTop 50 |
votes_total | Your new all time vote count |
votes_24h | Your votes in the last 24 hours |
Timeout: your listener has 5 seconds to respond. If no connection can be established, the postback is dropped (it will not be retried).
Configuration
Open your dashboard, edit your server and set the Postback URL and optional Postback password. Keep the password secret and verify it on every request.
Vote links
| Link | Purpose |
|---|---|
https://mmtop50.com/vote/[SERVER_ID] | Standard vote link - send players here from your website |
https://mmtop50.com/vote/[SERVER_ID]/[USER_ID] | Same, but includes your own user/player id in the callback so you can match the voter |
After a successful vote the player is redirected back to your listing page.
Sample listener (PHP)
<?php
if ($_SERVER["REQUEST_METHOD"] !== "POST") exit();
$postback_password = "CHANGE_ME"; // the password set in your listing
if (!hash_equals($postback_password, $_POST["postback_password"] ?? "")) exit();
$vote_counted = ($_POST["vote_counted"] ?? "0") === "1";
$ip = $_POST["ip_addr"] ?? "";
$uid = $_POST["uid"] ?? "";
if ($vote_counted) {
// TODO: find the player by $ip / $uid and grant the vote reward
}
?>
Tip: also accept requests only from your own validator IP if you want maximum safety.