Voting Check
Use our API to check if a player voted or not. Currently this API is just built to use with Silkroad Online servers. It will be updated soon..
Use our API to check if a player voted or not. Currently this API is just built to use with Silkroad Online servers. It will be updated soon..
Voting Check is a way to get your players rewarded for advertising your server. Usually the voting sites are not owned by the private server owners. So they are not able to check whether the voting-procedure has completed successfully or not. Most of them simply add virtual currencies to the player's account just for voting here.
Currently we provide a vote-pingback and a PHP API that you may use on your webserver. This API is build for Silkroad Servers but it can easily be used on any other kind of server with some little edits.
Vote Pingback is an information we send to any kind of web service that is listening to it and entered with us.
Of course not. We provided this API to make it easier for server owners to get everything working without much effort. I you want to integrate any different service listener, feel free.
Either you send your users a link to your voting-site with "?votingUserID=123" (without quotes) added behind your link so your link looks like this:
https://www.toplist50.com/games/mmorpg/freegame/yourgame/?votingUserID=123
Or you embed an iframe in your webpage with exact that format above.
#...
//open connection
$ch = curl_init();
$finalURL = $yourCallbackURL . "?action=vote&user=" . $theUserYouProvided . "&time=" . time();
//set the url, number of POST vars, etc..
curl_setopt($ch, CURLOPT_URL, $finalURL);
#...
//execute request
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$contents = curl_exec($ch);
//close connection
curl_close($ch);
#...
function yourFunction()
{
# Allow only our servers and
# local ones (for testing purposes)
$IPwhiteList = array(
"127.0.0.1", "::1",
gethostbyname("toplist50.com")
);
$echo = "undefined";
if (isset($_REQUEST["action"])) {
switch (trim($_REQUEST["action"])) {
case "vote":
# yea it`s a voting callback
if (in_array($_SERVER["REMOTE_ADDR"], $IPwhiteList)) {
# break on invalid calls
if (!isset($_REQUEST["user"]) || !isset($_REQUEST["time"]))
throw new NotFoundHttpException();
# ok, request allowed & valid
$userID = intval($_REQUEST["user"]);
$time = intval($_REQUEST["time"]);
// that`s it, user voted and you can give him a reward
$echo = "UPDATE users SET reward = reward + 1 WHERE userid = $userID";
die('OK');
}
break;
default:
$echo = "unknown action";
}
}
die('KO');
}