examples / proxycheck.io

PHP Example

Adding support for our API in your website is very easy with PHP. Simply add this to the top of your PHP files for Login or Registration forms or wherever you need proxies blocked. If you would like a more advanced PHP example utilising a reusable function please view this example for developers on our GitHub page.

<?php

  // If you have an API key you should enter it below between the quotes
  // example: $API_Key = "111111-222222-333333-444444";
  $API_Key = ""; // Supply your API key between the quotes if you have one  
  $VPN = "0"; // Change this to 1 if you wish to perform VPN Checks on your visitors
  $Tag = "1"; // This setting tags your queries with a message you can view in your dashboard stats
    
  // By default the tag used is your querying domain and the webpage being accessed
  // However you can supply your own descriptive tag or disable tagging altogether.
  if ( $Tag == 1 ) {
    $Tag = htmlspecialchars($_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
  } else {
    $Tag = "";
  }
  
  // If you're using CloudFlare change $_SERVER["REMOTE_ADDR"] to $_SERVER["HTTP_CF_CONNECTING_IP"]
  $visitor_ip = $_SERVER["REMOTE_ADDR"]; // Put visitor IP Address in a variable for later use

  // Querying the API through the non-TLS address (this is faster)
  $json = file_get_contents('http://proxycheck.io/v1/' . $visitor_ip . "&key=$API_Key" . "&vpn=$VPN" . "&tag=$Tag", true);

  // Decode the JSON from our API
  $json_decoded = json_decode($json);

  // Check if the IP we're testing is a proxy server
  if ( $json_decoded->proxy == "yes" && $json_decoded->ip == $visitor_ip) {

    // If this is a proxy server we display the message below and exit the script
    // This will stop the rest of the page loading to this visitor
    echo "Please turn your Proxy Server off and try our website again.";
    exit;
    
  }

?>

If you would like a more advanced example utilising a reusable function and cURL you can find it on our GitHub here


Minecraft Plugins

User multimc from spigotmc.org has written a free Minecraft plugin called AntyProxyTM which features the proxycheck.io API. Simply download the included file to your Minecraft servers plugin folder and reload your server. You'll then be able to place your API Key into the plugins configuration file. You can download the plugin at spigotmc.org here

User SamuelCnc3 from spigotmc.org has written a free Minecraft plugin called SimpleAntiProxy which features the proxycheck.io API. Simply download the included file to your Minecraft servers plugin folder and reload your server. You'll then be able to place your API Key into the plugins configuration file. You can download the plugin at spigotmc.org here

User DefianceCoding from spigotmc.org has written a free Minecraft plugin called Anti-Proxy which features the proxycheck.io API. Simply download the included file to your Minecraft servers plugin folder and reload your server. You'll then be able to place your API Key into the plugins configuration file. You can download the plugin at spigotmc.org here

User FusionStyleFX from spigotmc.org has written a paid Minecraft plugin called AntiBotDeluxeEX which features the proxycheck.io API. Simply download the included file to your Minecraft servers plugin folder and reload your server. You'll then be able to place your API Key into the plugins configuration file. You can download the plugin at spigotmc.org here


Back
Last updated: 26th of June 2017.26th of June 2017: Three new minecraft plugins were added to the page.

25th of May 2017: The PHP Example was updated to include our new query tagging feature.

7th of April 2017: A better PHP example utilising functions and cURL on GitHub was linked to from this page.

1st of April 2017: Information about a 3rd party Minecraft plugin which uses our API was added to the page.

21st of March 2017: The PHP code example now includes your API key by default if you have one.

Advertisement: