### ProxyCheck PHP v0.2.x Options Array Example Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md An example of how the options array was structured in versions prior to v1.0.0, using integers (1/0) for boolean flags. ```APIDOC ## ProxyCheck PHP v0.2.x Options Array Example ### Description This code snippet demonstrates the configuration options for the proxycheck-php library in versions v0.2.x and below. It highlights the use of integers (1 for true, 0 for false) for enabling or disabling various features. ### Method `proxycheck\proxycheck::check(string $address, array $options) ### Endpoint N/A (Local library method) ### Parameters #### Request Body - **$address** (string) - The IP address or email address to check. - **$proxycheck_options** (array) - An associative array containing configuration options: - **API_KEY** (string) - Your ProxyCheck API Key. - **HMAC_KEY** (string) - Optional HMAC key for TLS security. - **ASN_DATA** (integer) - 1 to enable ASN data, 0 to disable. - **DAY_RESTRICTOR** (integer) - Restrict checking to proxies seen in the past N days. - **VPN_DETECTION** (integer) - 1 to enable VPN and Proxy detection, 0 to disable. - **RISK_DATA** (integer) - 0 for off, 1 for Risk Score (0-100), 2 for Risk Score & Attack History. - **INF_ENGINE** (integer) - 1 to enable inference engine, 0 to disable. - **TLS_SECURITY** (integer) - 1 to enable TLS security, 0 to disable. - **QUERY_TAGGING** (integer) - 1 to enable query tagging, 0 to disable. - **MASK_ADDRESS** (integer) - 1 to anonymize email local-part, 0 to disable. - **CUSTOM_TAG** (string) - A custom query tag. - **BLOCKED_COUNTRIES** (array) - An array of countries or isocodes to block. - **ALLOWED_COUNTRIES** (array) - An array of countries or isocodes to allow. ### Request Example ```php // Get your visitors IP address $address = $_SERVER["REMOTE_ADDR"]; // Input your options for this query $proxycheck_options = array( 'API_KEY' => '######-######-######-######', 'HMAC_KEY' => '', 'ASN_DATA' => 1, 'DAY_RESTRICTOR' => 7, 'VPN_DETECTION' => 1, 'RISK_DATA' => 1, 'INF_ENGINE' => 1, 'TLS_SECURITY' => 0, 'QUERY_TAGGING' => 1, 'MASK_ADDRESS' => 1, 'CUSTOM_TAG' => '', 'BLOCKED_COUNTRIES' => array('Wakanda', 'WA'), 'ALLOWED_COUNTRIES' => array('Azeroth', 'AJ') ); $result_array = \proxycheck\proxycheck::check($address, $proxycheck_options); ``` ### Response #### Success Response (200) - **block** (string) - 'yes' or 'no' indicating if the address is blocked. - **block_reason** (string) - The reason for the block. - (Other fields based on enabled options) #### Response Example ```json { "status": "success", "proxy": "yes", "proxy_type": "VPN", "ip_address": "127.0.0.1", "country": "US", "vpn_detection": 1, "block": "yes", "block_reason": "VPN Detected" } ``` ``` -------------------------------- ### Install proxycheck-php Library via Composer Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Installs the proxycheck-php library using Composer, the dependency manager for PHP. This command adds the library to your project's dependencies. ```bash composer require proxycheck/proxycheck-php ``` -------------------------------- ### ProxyCheck PHP v1.0.0+ Options Array Example Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md An example of the updated options array structure for versions v1.0.0 and above, utilizing booleans (true/false) and reflecting changes due to the v3 API integration. ```APIDOC ## ProxyCheck PHP v1.0.0+ Options Array Example ### Description This code snippet illustrates the new configuration options for the proxycheck-php library starting from version v1.0.0. It shows the shift to using boolean values (true/false) for enabling/disabling features and reflects the impact of migrating to the proxycheck.io v3 API. ### Method `proxycheck\proxycheck::check(string $address, array $options) ### Endpoint N/A (Local library method) ### Parameters #### Request Body - **$address** (string) - The IP address or email address to check. - **$proxycheck_options** (array) - An associative array containing configuration options: - **API_KEY** (string) - Your ProxyCheck API Key. - **HMAC_KEY** (string) - Optional HMAC key for TLS security. - **ASN_DATA** (boolean) - `true` to enable ASN data, `false` to disable. - **DAY_RESTRICTOR** (integer) - Restrict checking to proxies seen in the past N days. - **VPN_DETECTION** (boolean) - `true` to enable VPN and Proxy detection, `false` to disable. - **RISK_DATA** (integer) - 0 for off, 1 for Risk Score (0-100), 2 for Risk Score & Attack History. - **INF_ENGINE** (boolean) - `true` to enable inference engine, `false` to disable. - **TLS_SECURITY** (boolean) - `true` to enable TLS security, `false` to disable. - **QUERY_TAGGING** (boolean) - `true` to enable query tagging, `false` to disable. - **MASK_ADDRESS** (boolean) - `true` to anonymize email local-part, `false` to disable. - **CUSTOM_TAG** (string) - A custom query tag. - **BLOCKED_COUNTRIES** (array) - An array of countries or isocodes to block. - **ALLOWED_COUNTRIES** (array) - An array of countries or isocodes to allow. ### Request Example ```php // Get your visitors IP address $address = $_SERVER["REMOTE_ADDR"]; // Input your options for this query $proxycheck_options = array( 'API_KEY' => '######-######-######-######', 'HMAC_KEY' => '', 'ASN_DATA' => true, 'DAY_RESTRICTION' => 7, 'VPN_DETECTION' => true, 'RISK_DATA' => 1, 'INF_ENGINE' => true, 'TLS_SECURITY' => true, 'QUERY_TAGGING' => true, 'MASK_ADDRESS' => true, 'CUSTOM_TAG' => '', 'BLOCKED_COUNTRIES' => array('Wakanda', 'WA'), 'ALLOWED_COUNTRIES' => array('Azeroth', 'AJ') ); $result_array = \proxycheck\proxycheck::check($address, $proxycheck_options); ``` ### Response #### Success Response (200) - **block** (boolean) - `true` or `false` indicating if the address is blocked. - **block_reason** (string) - The reason for the block. - (The full API response is now more detailed due to the v3 API, providing comprehensive detection data.) #### Response Example ```json { "status": "success", "proxy": { "risk": 10, "proxy": true, "type": "VPN", "last_seen": 1678886400, "ip_address": "127.0.0.1", "country": "US", "vpn_detection": true }, "risk_data": { "score": 10, "attack": { "recent": 0, "history": 0 } }, "block": true, "block_reason": "VPN Detected" } ``` ``` -------------------------------- ### PHP: Full Proxycheck API Response Example Structure Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md This example illustrates the comprehensive structure of a Proxycheck API response array in PHP. It includes the query status, detailed information for a specific IP address (network, location, device, detections, operator), and the query time. This data can be used for granular control over blocking or for analyzing IP address characteristics. ```php 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 } ``` -------------------------------- ### Include Composer Autoloader in PHP Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Includes the Composer autoloader file in your PHP script to enable the use of installed libraries, including proxycheck-php. ```php require_once('vendor/autoload.php'); ``` -------------------------------- ### PHP: Block based on Specific Detection Types Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md This example demonstrates how to block IPs based on specific detection types like VPN, TOR, or compromised addresses, while excluding others like hosting. It involves setting individual detection options (e.g., PROXY_DETECTION, VPN_DETECTION) to true and others (e.g., HOSTING_DETECTION) to false. This allows for granular control over blocking criteria, ensuring that anonymous detection doesn't override more specific settings. ```php // 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. 'HMAC_KEY' => '', // Optional HMAC key from the Dashboard, requires TLS_SECURITY set to true. 'DAY_RESTRICTOR' => 7, // Restrict checking to proxies seen in the past # of days. 'ANONYMOUS_DETECTION' => true, // Set to true to enable Anonymous detections 'PROXY_DETECTION' => true, // Set to true to enable Proxy detections 'VPN_DETECTION' => true, // Set to true to enable VPN detections 'SCRAPER_DETECTION' => true, // Set to true to enable Scraper detections 'TOR_DETECTION' => true, // Set to true to enable TOR detections 'COMPROMISED_DETECTION' => true, // Set to true to enable Compromised Address detections 'HOSTING_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. anonymous@domain.tld) 'CUSTOM_TAG' => '0', // Specify a custom query tag instead of the default (Domain+Page). '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); ``` -------------------------------- ### Print All ProxyCheck Custom Rules (PHP) Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md This PHP code snippet shows how to retrieve a list of all custom rules configured in your ProxyCheck account. By leaving `RULE_SELECTION` blank and setting `RULE_ACTION` to 'print', the library returns an array containing the names, IDs, and states of all your rules. An API key is mandatory for this operation. ```php $proxycheck_options = array( 'API_KEY' => '', // Your API Key. 'TLS_SECURITY' => true, // Enable or disable transport security (TLS). 'RULE_SELECTION' => '', // Leave blank to print all rule names, ID's and states 'RULE_ACTION' => 'print', // Specify an action: enable, disable or print. ); $result_array = \proxycheck\proxycheck::rules($proxycheck_options); ``` -------------------------------- ### PHP: Proxycheck Options Array - Old Version (v0.2.x and below) Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md This PHP code snippet illustrates the structure of the options array used in proxycheck-php versions prior to v1.0.0. It shows how integer values (0 or 1) were used to enable or disable various query flags and settings. The snippet also includes comments on retrieving visitor IP addresses, handling CloudFlare, and the structure of the API key. ```php // 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. 'HMAC_KEY' => '', // Optional HMAC key from the Dashboard, requires TLS_SECURITY set to true. '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. anonymous@domain.tld) '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); ``` -------------------------------- ### Viewing Statistics Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Retrieve statistics such as queries, limits, and plan tier from your Proxycheck account dashboard. Supports 'usage', 'detections', and 'queries' as stat selections. For 'detections', 'limit' and 'offset' can be specified. ```APIDOC ## Viewing Statistics from your Dashboard ## ### Description Retrieve statistics like queries, limits, and plan tier from your account dashboard. Supports 'usage', 'detections', and 'queries' as stat selections. For 'detections', 'limit' and 'offset' can be specified. ### Method POST (or relevant method for the library function) ### Endpoint N/A (This is a library function call) ### Parameters #### Request Body (Conceptual for library options) - **API_KEY** (string) - Required - Your Proxycheck API Key. - **TLS_SECURITY** (boolean) - Optional - Enable or disable transport security (TLS). Defaults to true. - **STAT_SELECTION** (string) - Required - Stats to view: 'detections', 'usage', or 'queries'. - **LIMIT** (integer) - Optional - Specify how many entries to view (applies to detection stats only). - **OFFSET** (integer) - Optional - Specify an offset in the entries to view (applies to detection stats only). ### Request Example ```php $proxycheck_options = array( 'API_KEY' => 'YOUR_API_KEY', 'TLS_SECURITY' => true, 'STAT_SELECTION' => 'usage', 'LIMIT' => '10', 'OFFSET' => '0' ); $result_array = \proxycheck\proxycheck::stats($proxycheck_options); ``` ### Response #### Success Response (200) - **Queries Today** (integer) - Number of queries made today. - **Daily Limit** (integer) - Your daily query limit. - **Queries Total** (integer) - Total number of queries made. - **Plan Tier** (string) - Your current plan tier (e.g., 'Free'). #### Response Example ```php Array ( [Queries Today] => 234 [Daily Limit] => 1000 [Queries Total] => 840931 [Plan Tier] => Free ) ``` ``` -------------------------------- ### PHP: View Proxycheck Usage Statistics Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Fetches usage statistics such as queries today, daily limit, total queries, and plan tier from the proxycheck dashboard. Requires an API key and dashboard API access enabled. Supports selecting 'usage', 'detections', or 'queries' stats, with optional 'limit' and 'offset' for 'detections'. ```php $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 = proxycheckproxycheck::stats($proxycheck_options); ``` ```php Array ( [Queries Today] => 234 [Daily Limit] => 1000 [Queries Total] => 840931 [Plan Tier] => Free ) ``` -------------------------------- ### View Specific ProxyCheck Custom Rule Data (PHP) Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md This PHP code snippet allows you to fetch all data for a specific custom rule, similar to downloading it from the customer dashboard. By providing the rule's name or ID in `RULE_SELECTION` and setting `RULE_ACTION` to 'print', you receive a detailed output that can be saved as a JSON file. An API key is required. ```php $proxycheck_options = array( 'API_KEY' => '', // Your API Key. 'TLS_SECURITY' => true, // Enable or disable transport security (TLS). 'RULE_SELECTION' => 'Your Rule Name or ID', // Specify the rule you're accessing by name or ID 'RULE_ACTION' => 'print', // Specify an action: enable, disable or print. ); $result_array = \proxycheck\proxycheck::rules($proxycheck_options); ``` -------------------------------- ### PHP: Manage Proxycheck Whitelist/Blacklist/CORS Origins Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Adds, removes, sets, or clears entries from the whitelist, blacklist, or CORS origins list. Requires an API key and dashboard API access. Supports specifying the list type ('whitelist', 'blacklist', 'CORS') and action ('add', 'remove', 'set', 'clear'), along with an array of entries. ```php $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 = proxycheckproxycheck::listing($proxycheck_options); ``` -------------------------------- ### Display Proxycheck API Response - JSON Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md This JSON structure represents the complete response from the proxycheck.io v3 API for a given IP address. It includes detailed information categorized into network, location, detections, device estimate, and operator details. 'Unknown' is used for fields without available data, and boolean values indicate status. ```json { "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": 1757590444 }, "query_time": 5 } ``` -------------------------------- ### Perform IP or Email Address Check with proxycheck-php Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Demonstrates how to use the proxycheck-php library to check an IP address or an email address. It shows how to configure various options such as API key, detection types, country restrictions, and HMAC security. ```php // 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. 'HMAC_KEY' => '', // Optional HMAC key from the Dashboard, requires TLS_SECURITY set to true. '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. anonymous@domain.tld) '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); ``` -------------------------------- ### Manipulating CORS Origins, Whitelist, or Blacklist Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md Manage your whitelist, blacklist, or CORS origins through the API. Supports adding, removing, setting, and clearing entries. Entries can include IPs, ranges, ASNs, emails, or domains for CORS. ```APIDOC ## Manipulating your CORS Origins, Whitelist or Blacklist ## ### Description Manage your whitelist, blacklist, or CORS origins through the API. Supports adding, removing, setting, and clearing entries. Entries can include IPs, ranges, ASNs, emails, or domains for CORS. Comments can be added to whitelist/blacklist entries but not to CORS origins. ### Method POST (or relevant method for the library function) ### Endpoint N/A (This is a library function call) ### Parameters #### Request Body (Conceptual for library options) - **API_KEY** (string) - Required - Your Proxycheck API Key. - **TLS_SECURITY** (boolean) - Optional - Enable or disable transport security (TLS). Defaults to true. - **LIST_SELECTION** (string) - Required - Specify the list you're accessing: 'CORS', 'whitelist', or 'blacklist'. - **LIST_ACTION** (string) - Required - Specify an action: 'list', 'add', 'remove', 'set' or 'clear'. - **LIST_ENTRIES** (array) - Required for 'add', 'remove', 'set' actions - Origins, IPs, Ranges, ASN's or Emails to be added, removed or set. Supports comments for whitelist/blacklist entries (e.g., '8.8.8.8 #this is google'). CORS entries do not support comments. ### Request Example ```php $proxycheck_options = array( 'API_KEY' => 'YOUR_API_KEY', 'TLS_SECURITY' => true, 'LIST_SELECTION' => 'whitelist', 'LIST_ACTION' => 'add', 'LIST_ENTRIES' => array('8.8.8.8', '1.1.1.1/24', 'AS888') ); $result_array = \proxycheck\proxycheck::listing($proxycheck_options); ``` ### Response #### Success Response (200) - The response structure varies depending on the `LIST_ACTION`. For 'list', it might return the current list content. For 'add', 'remove', 'set', it might return a status message or confirmation. #### Response Example (Conceptual for adding to whitelist) ```php Array ( [status] => success [message] => Whitelist updated successfully. ) ``` ``` -------------------------------- ### Proxy IP Address Check API Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md This section details the response structure for checking an IP address using the ProxyCheck API v3. It outlines the new format which includes boolean values for all responses and data categorized into network, location, detections, device_estimate, and operator sections. ```APIDOC ## GET /api/v3/proxycheck/ ### Description This endpoint checks a given IP address for proxy, VPN, and other suspicious activities. The response format has been updated in v3 to use booleans for all values, 'Unknown' for missing data, and categorizes information into distinct sections. ### Method GET ### Endpoint `/api/v3/proxycheck/` ### Parameters #### Query Parameters - **ip** (string) - Required - The IP address to check. - **vpn** (boolean) - Optional - Whether to detect VPNs. - **proxy** (boolean) - Optional - Whether to detect proxies. - **tor** (boolean) - Optional - Whether to detect Tor exit nodes. - **hosting** (boolean) - Optional - Whether to detect hosting providers. - **snippet** (boolean) - Optional - Whether to include a snippet in the response. - **tag** (string) - Optional - A tag to associate with the request. ### Request Example No request body for GET requests. ### Response #### Success Response (200) - **status** (string) - The status of the API request (e.g., "ok"). - **[ip_address]** (object) - An object containing details about the checked IP address. - **network** (object) - Network-related information. - **asn** (string) - Autonomous System Number. - **range** (string) - IP address range. - **hostname** (string) - Hostname associated with the IP. - **provider** (string) - Network provider name. - **organisation** (string) - Organisation name. - **type** (string) - Type of network connection (e.g., "Hosting"). - **location** (object) - Geographical location information. - **continent_name** (string) - Name of the continent. - **continent_code** (string) - Code for the continent. - **country_name** (string) - Name of the country. - **country_code** (string) - Code for the country. - **region_name** (string) - Name of the region/state. - **region_code** (string) - Code for the region/state. - **city_name** (string) - Name of the city. - **postal_code** (string) - Postal code. - **latitude** (number) - Latitude coordinate. - **longitude** (number) - Longitude coordinate. - **timezone** (string) - Timezone identifier. - **currency** (object) - Currency information. - **code** (string) - Currency code. - **name** (string) - Currency name. - **symbol** (string) - Currency symbol. - **device_estimate** (object) - Estimated device information. - **address** (number) - Estimated number of devices at the address. - **subnet** (number) - Estimated number of devices on the subnet. - **detections** (object) - Detection results. - **proxy** (boolean) - True if detected as a proxy. - **vpn** (boolean) - True if detected as a VPN. - **compromised** (boolean) - True if detected as compromised. - **scraper** (boolean) - True if detected as a scraper. - **tor** (boolean) - True if detected as Tor. - **hosting** (boolean) - True if detected as hosting. - **anonymous** (boolean) - True if detected as anonymous. - **risk** (number) - Risk score (0-100). - **operator** (object) - Information about the network operator. - **name** (string) - Operator name. - **url** (string) - Operator website URL. - **anonymity** (string) - Anonymity level. - **popularity** (string) - Popularity level. - **protocols** (array of strings) - Supported protocols. - **policies** (object) - Operator policies. - **ad_filtering** (boolean) - Whether ad filtering is supported. - **free_access** (boolean) - Whether free access is available. - **paid_access** (boolean) - Whether paid access is available. - **port_forwarding** (boolean) - Whether port forwarding is supported. - **logging** (boolean) - Whether logging is practiced. - **anonymous_payments** (boolean) - Whether anonymous payments are accepted. - **crypto_payments** (boolean) - Whether crypto payments are accepted. - **traceable_ownership** (boolean) - Whether ownership is traceable. - **last_updated** (integer) - Timestamp of the last update for this IP's data. - **query_time** (number) - Time taken to process the query in milliseconds. #### Response Example ```json { "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": 1757590444 }, "query_time": 5 } ``` ``` -------------------------------- ### PHP: Check Proxy or VPN Block Status from Query Result Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md This PHP code snippet demonstrates how to check the 'block' status from a query result array. If 'block' is true, it displays the 'block_reason'; otherwise, it indicates the user is not blocked. This is useful for implementing simple IP-based blocking systems. Note that 'block' and 'block_reason' are only populated for single IP checks. ```php 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."; } ``` -------------------------------- ### PHP: Block based on Anonymous IP Detection Source: https://github.com/proxycheck/proxycheck-php/blob/master/UPGRADE.md This snippet shows how to configure the ProxyCheck PHP library to block requests if an IP address is detected as anonymous. It sets the ANONYMOUS_DETECTION option to true, which causes the API to return a 'block: true' result for anonymous IPs. The code retrieves the visitor's IP and passes it with custom options to the proxycheck::check method. ```php // 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. 'HMAC_KEY' => '', // Optional HMAC key from the Dashboard, requires TLS_SECURITY set to true. 'DAY_RESTRICTOR' => 7, // Restrict checking to proxies seen in the past # of days. 'ANONYMOUS_DETECTION' => true, // Set to true to enable Anonymous 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. anonymous@domain.tld) 'CUSTOM_TAG' => '0', // Specify a custom query tag instead of the default (Domain+Page). '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); ``` -------------------------------- ### Disable ProxyCheck Custom Rule by Name (PHP) Source: https://github.com/proxycheck/proxycheck-php/blob/master/README.md This PHP code snippet demonstrates how to disable a custom rule within ProxyCheck by specifying its name in the `RULE_SELECTION` option. It requires an API key and configures TLS security. The output is an array containing the result of the rule manipulation. ```php $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); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.