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.
  'VPN_DETECTION' => 1, // Check for both VPN's and Proxies instead of just Proxies.
  'RISK_DATA' => 1, // 0 = Off, 1 = Risk Score (0-100), 2 = Risk Score & Attack History.
  'INF_ENGINE' => 1, // Enable or disable the real-time inference engine.
  'TLS_SECURITY' => 0, // Enable or disable transport security (TLS).
  'QUERY_TAGGING' => 1, // Enable or disable query tagging.
  'MASK_ADDRESS' => 1, // 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'] == "yes" ) {
    
  // 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/warning/denied/error
    [node] => answering_node_name
    [###.###.###.###] => Array
        (
            [asn] => AS#####
            [range] => ###.###.###.###/24
            [hostname] => 78-2-adsl.acme.net
            [provider] => Acme Incorporated
            [organisation] => Acme Net
            [country] => Wakanda
            [isocode] => WA
            [region] => Wakanda North
            [regioncode] => WAN
            [city] => Birnin Zana
            [postcode] => BZ967
            [latitude] => 2.5072
            [longitude] => -0.1276
            [currency] => Array
                (
                    [code] => VD
                    [name] => Vibranium Dollar
                    [symbol] => $
                )
            [proxy] => yes/no
            [type] => VPN/SOCKS5/SOCKS4/SOCKS/HTTP/HTTPS/Compromised Server
            [risk] => 0 to 100
            [port] => #####
            [last seen human] => 6 hours, 18 minutes, 49 seconds ago
            [last seen unix] => 1528687645
        )
    [block] => yes/no
    [block_reason] => proxy/vpn/country
)

$proxycheck_options = array(
  'API_KEY' => '', // Your API Key.
  'TLS_SECURITY' => 0, // 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' => 0, // 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);
bash
composer 
'LIST_ENTRIES' => array('8.8.8.8 #this is google')