PHP code example of proxycheck / proxycheck-php

1. Go to this page and download the library: Download proxycheck/proxycheck-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

proxycheck / proxycheck-php example snippets




// Get your visitors IP address or email address
// If you're using CloudFlare change $_SERVER["REMOTE_ADDR"] to $_SERVER["HTTP_CF_CONNECTING_IP"]
// You may also supply an array of addresses in $address to check multiple addresses at once.
$address = $_SERVER["REMOTE_ADDR"];

// Input your options for this query including your optional API Key and query flags.
$proxycheck_options = array(
  'API_KEY' => '######-######-######-######', // Your API Key.
  'ASN_DATA' => 1, // Enable ASN data response.
  'DAY_RESTRICTOR' => 7, // Restrict checking to proxies seen in the past # of days.
  'ANONYMOUS_DETECTION' => true, // Set to true to enable Anonymous detections (setting this to true can override other detection types)
  'PROXY_DETECTION' => false, // Set to true to enable Proxy detections
  'VPN_DETECTION' => false, // Set to true to enable VPN detections
  'SCRAPER_DETECTION' => false, // Set to true to enable Scraper detections
  'TOR_DETECTION' => false, // Set to true to enable TOR detections
  'COMPROMISED_DETECTION' => false, // Set to true to enable Compromised Address detections
  'HOST_DETECTION' => false, // Set to true to enable Hosting detections
  'TLS_SECURITY' => false, // Enable or disable transport security (TLS).
  'QUERY_TAGGING' => true, // Enable or disable query tagging.
  'MASK_ADDRESS' => true, // Anonymises the local-part of an email address (e.g. [email protected])
  'CUSTOM_TAG' => '', // Specify a custom query tag instead of the default (Domain+Page).
  'BLOCKED_COUNTRIES' => array('Wakanda', 'WA'), // Specify an array of countries or isocodes to be blocked.
  'ALLOWED_COUNTRIES' => array('Azeroth', 'AJ') // Specify an array of countries or isocodes to be allowed.
);
  
$result_array = \proxycheck\proxycheck::check($address, $proxycheck_options);

if ( $result_array['block'] === true ) {
    
  // Example of a block and the reason why.
  echo "Blocked, reason: " . $result_array['block_reason'];
  exit;

} else {
    
  // No Proxy / VPN / Blocked Country detected.
  echo "Not blocked.";
    
}

Array
{
    "status": "ok",
    "185.59.221.75": {
        "network": {
            "asn": "AS60068",
            "range": "185.59.221.0/24",
            "hostname": "185.59.221.75.adsl.inet-telecom.org",
            "provider": "Datacamp Limited",
            "organisation": "CDN77 - London POP",
            "type": "Hosting"
        },
        "location": {
            "continent_name": "Europe",
            "continent_code": "EU",
            "country_name": "United Kingdom",
            "country_code": "GB",
            "region_name": "England",
            "region_code": "ENG",
            "city_name": "London",
            "postal_code": "W1B",
            "latitude": 51.5072,
            "longitude": -0.1276,
            "timezone": "Europe/Paris",
            "currency": {
                "code": "Pound",
                "name": "GBP",
                "symbol": "£"
            }
        },
        "device_estimate": {
            "address": 50,
            "subnet": 1890
        },
        "detections": {
            "proxy": false,
            "vpn": true,
            "compromised": true,
            "scraper": false,
            "tor": false,
            "hosting": true,
            "anonymous": true,
            "risk": 100
        },
        "operator": {
            "name": "IVPN",
            "url": "https://www.ivpn.net/",
            "anonymity": "high",
            "popularity": "medium",
            "protocols": [
                "WireGuard",
                "OpenVPN",
                "IPSec",
                "IKEv2"
            ],
            "policies": {
                "ad_filtering": true,
                "free_access": false,
                "paid_access": true,
                "port_forwarding": false,
                "logging": false,
                "anonymous_payments": true,
                "crypto_payments": true,
                "traceable_ownership": true
            }
        },
        "last_updated": 1757593655
    },
    "query_time": 5
}

$proxycheck_options = array(
  'API_KEY' => '', // Your API Key.
  'TLS_SECURITY' => true, // Enable or disable transport security (TLS).
  'STAT_SELECTION' => 'usage', // Stats to view: detections, usage or queries
  'LIMIT' => '10', // Specify how many entries to view (applies to detection stats only)
  'OFFSET' => '0' // Specify an offset in the entries to view (applies to detection stats only)
);
    
$result_array = \proxycheck\proxycheck::stats($proxycheck_options);

Array
(
    [Queries Today] => 234
    [Daily Limit] => 1000
    [Queries Total] => 840931
    [Plan Tier] => Free
)

$proxycheck_options = array(
  'API_KEY' => '', // Your API Key.
  'TLS_SECURITY' => true, // Enable or disable transport security (TLS).
  'LIST_SELECTION' => 'whitelist', // Specify the list you're accessing: CORS, whitelist or blacklist
  'LIST_ACTION' => 'add', // Specify an action: list, add, remove, set or clear.
  'LIST_ENTRIES' => array('8.8.8.8', '1.1.1.1/24', 'AS888') // Origins, IPs, Ranges, ASN's or Emails to be added, removed or set
);
    
$result_array = \proxycheck\proxycheck::listing($proxycheck_options);

$proxycheck_options = array(
  'API_KEY' => '', // Your API Key.
  'TLS_SECURITY' => true, // Enable or disable transport security (TLS).
  'RULE_SELECTION' => 'Elevate Risk Score Rule', // Specify the rule you're accessing by name or ID (leave blank to print all rule names, ID's and states)
  'RULE_ACTION' => 'disable', // Specify an action: enable, disable or print.
);
    
$result_array = \proxycheck\proxycheck::rules($proxycheck_options);
bash
composer 
'LIST_ENTRIES' => array('8.8.8.8 #this is google')