Skip to content

Commit

Permalink
Added Dashboard API usage example
Browse files Browse the repository at this point in the history
At the bottom of this document there is a new section called Manipulating your Whitelist/Blacklist. This shows you how to list, add, remove, set or clear your white or blacklist which is present within your dashboard on our website.
  • Loading branch information
proxycheck authored Nov 23, 2018
1 parent 1b703f5 commit 755cce0
Showing 1 changed file with 46 additions and 25 deletions.
71 changes: 46 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,43 +34,43 @@ Get your API Key at [proxycheck.io](http://proxycheck.io/) it's free.
Performing a check on an IP Address (IPv4 and IPv6 supported).

```php
// Get your visitors IP Address
// If you're using CloudFlare change $_SERVER["REMOTE_ADDR"] to $_SERVER["HTTP_CF_CONNECTING_IP"]
$ip = $_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.
'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.
'CUSTOM_TAG' => '', // Specify a custom query tag instead of the default (Domain+Page).
'BLOCKED_COUNTRIES' => array('Wakanda', 'Mordor') // Specify an array of countries to be blocked.
);
// Get your visitors IP Address
// If you're using CloudFlare change $_SERVER["REMOTE_ADDR"] to $_SERVER["HTTP_CF_CONNECTING_IP"]
$ip = $_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.
'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.
'CUSTOM_TAG' => '', // Specify a custom query tag instead of the default (Domain+Page).
'BLOCKED_COUNTRIES' => array('Wakanda', 'Mordor') // Specify an array of countries to be blocked.
);

$result_array = \proxycheck\proxycheck::check($ip, $proxycheck_options);
$result_array = \proxycheck\proxycheck::check($ip, $proxycheck_options);
```

## Viewing the query result ##

When performing a query you will receive back an array which contains various information. Below is an example of parsing that array to determine if this user should be blocked or not.

```php
if ( $result_array['block'] == "yes" ) {
if ( $result_array['block'] == "yes" ) {

// Example of a block and the reason why.
echo "Blocked, reason: " . $result_array['block_reason'];
exit;
// Example of a block and the reason why.
echo "Blocked, reason: " . $result_array['block_reason'];
exit;

} else {
} else {

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

}
}
```

## Extra information included in the query result ##
Expand Down Expand Up @@ -101,3 +101,24 @@ Array

In the above example the ```status``` field lets you know the status of this query. You can view all our API responses [here](https://proxycheck.io/api/) within our API documentation page. Also where in our example we show ```###.###.###.###``` you will receive the actual IP Address you sent to the API for checking.

## Manipulating your Whitelist/Blacklist ##

In version 0.1.2 (Nov 2018) we added the ability to view, add, remove, set and clear your whitelist and blacklist through this library. Below is an example of adding three entries to your whitelist in a single query.

```php
$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: 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') // Addresses, Ranges or ASN's to be added, removed or set
);

$result_array = \proxycheck\proxycheck::listing($proxycheck_options);
```

When accessing dashboard API's an API Key is always required as the dashboard is only for registered users (both free and paid have full dashboard access). You will also need to make sure you have Dashboard API access enabled [within your dashboard](https://proxycheck.io/dashboard/) on our website.

You can see that in the LIST_ENTRIES field we are providing an array of three seperate entries, this field is only used if you're performing an add, remove or set action. When providing entries in the LIST_ENTRIES field you can include comments, for example ```'LIST_ENTRIES' => array('8.8.8.8 #this is google')``` would create a new entry with the comment intact.

If an entry you're removing has a comment next to it you will need to include that comment in the removal request aswell, like in the example above where we included a comment next to the IP Address we were adding you would do the same when removing it.

0 comments on commit 755cce0

Please sign in to comment.