Add a server

Take a look at our APIs to check the votes and track your stats

API documentation

Voting API (JSON)

Our API allows you to verify that a user's vote has been completed. It returns the data in JSON with the date of the vote, the time remaining before the next one and the nickname.

<?php
$API_key = TOKEN; // Token of your server
$API_ip = $_SERVER['REMOTE_ADDR']; // IP address of the user
$json = file_get_contents("https://serveur-prive.net/api/vote/json/$API_key/$API_ip");
$json_data = json_decode($json);

if($json_data->status == 1) {
echo 'You have voted successfully';

// You can use the following variables:
$json_data->vote; // Corresponds to the date of the vote in timestamp format
$json_data->nextvote; // Corresponds to the number of seconds remaining before the user can vote again
$json_data->pseudo; // Username of the user (if he specified his username during his vote)
}
else {
echo 'Have not or already voted';
}
?>

Result Example

"status" = 1

{"status":"1","vote":"1539775097","nextvote":"3749","pseudo":"Trevor"}

"status" = 0

{"status":"0"}

Statistics API (JSON)

Statistics API that retrieves the number of votes, clicks, comments or your server's note in JSON format.

<?php
$API_key = TOKEN; // Token of your server
$API_da = 'vote'; // vote,clic,commentaire,note,position
$json = file_get_contents("https://serveur-prive.net/api/stats/json/$API_key/$API_da");
$json_data = json_decode($json);

if($json_data->status == 1) {
echo $json_data->data;
}
else {
echo 'Server Token error or invalid value';
}
?>

Result Example

"status" = 1

{"status":"1","data":"1157"}

"status" = 0

{"status":"0"}

Known incompatibilities

If you use Cloudflare on your website, the IP address is recovered in this way.

<?php
// Cloudflare IP recovery
if(isset($_SERVER["HTTP_CF_CONNECTING_IP"])) {
$_SERVER['REMOTE_ADDR'] = $_SERVER["HTTP_CF_CONNECTING_IP"];
}
?>
  • Server-prive.net is not compatible with IPV6. Find more information about it on the FAQ page.
  • Make sure that your website is not IPV6 compatible from the site ipv6-test.com
  • Documentation to disable IPV6 at Cloudflare from their API.