Trafficfilter.io v3 API Document
V3 API Description
v3 is an upgraded version of mixed, which adds behavioural validation of browser fingerprints to be more accurate
v3 return visitor ID rating (0-100)
Score Explain
Trafficfilter.io will return a real person probability score of 0-100 (Fingerprint score)
Score range | Explain |
---|---|
96-100 | The probability of a real person is very high. |
50-95 | Real device with suspicious behaviour. |
0-49 | False or untrusted device. |
Trafficfilter.io will return a real person probability score of 0-100 (IP score)
Score range | Explain |
---|---|
86-100 | The probability of a real person is very high. |
71-85 | IP address has suspicious behavior, probably real person. |
0-70 | IP has abnormal behavior, low probability of real person. |
Example:Request Blocking(PHP)(PHP)(API v3)
index.php
<?php
$email = 'xxx@abc.com';
$password = '12345678';
$allow_country=['US','CA'];
$allow_ip_score = 100;
$allow_fp_score = 100;
$allow_device = ['desktop', 'tablet', 'mobile'];
$landing_page = 'landing_page.html';
$safe_page = 'safe_page.html';
session_start();
if (isset($_SESSION['trafficfilter_visitor_id'])) {
if (isset($_SESSION['trafficfilter_result'])) {
unset($_SESSION['trafficfilter_result']);
include($landing_page);
} else {
$data = request_trafficfilter([
'action' => 'get_result',
'email' => $email,
'password' => $password,
'client_ip' => ip_trafficfilter(),
'identifier' => $_SERVER['HTTP_HOST'],
'data' => $_SESSION['trafficfilter_visitor_id']
]);
if ($data['ip_score'] >= $allow_ip_score && $data['fingerprint_score'] >= $allow_fp_score && in_array($data['country'], $allow_country) && in_array($data['device'], $allow_device)) {
include($landing_page);
} else {
echo file_get_contents($safe_page);
}
}
} else {
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$data = request_trafficfilter([
'action' => 'get_replace',
'email' => $email,
'password' => $password,
]);
$content = file_get_contents($safe_page);
if (isset($data['search'][0]) && isset($data['replace'][0])) {
$content = str_replace($data['search'], $data['replace'], $content);
}
echo $content;
} else {
$post_data = isset($_POST['_']) ? $_POST['_'] : '';
$data = request_trafficfilter([
'action' => 'get_result',
'email' => $email,
'password' => $password,
'client_ip' => ip_trafficfilter(),
'identifier' => $_SERVER['HTTP_HOST'],
'data' => $post_data
]);
if ($data['visitor_id']) {
$_SESSION['trafficfilter_visitor_id'] = $data['visitor_id'];
if ($data['ip_score'] >= $allow_ip_score && $data['fingerprint_score'] >= $allow_fp_score && in_array($data['country'], $allow_country) && in_array($data['device'], $allow_device)) {
$_SESSION['trafficfilter_result'] = true;
echo '1';
}
}
}
}
function ip_trafficfilter()
{
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
return $_SERVER['HTTP_CF_CONNECTING_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
return $ip_arr[0];
} else {
return $_SERVER['REMOTE_ADDR'];
}
}
function request_trafficfilter($data)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://trafficfilter.io/v3');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
$res = curl_exec($curl);
if (is_array(json_decode($res, true))) {
$res = json_decode($res, true);
} else {
echo $res;
}
curl_close($curl);
return $res;
}
landing_page.html
<!DOCTYPE html>
<html>
<head>
<title>Landing page</title>
</head>
<body>
Here is your Landing page
</body>
</html>
safe_page.html
<html>
<head>
<title>Access denied</title>
</head>
<body>
Your request has been denied.
</body>
</html>
Trafficfilter.io Mixed API Document
Mixed API Description
Due to some customer requests, we have added Mixed API(v1 & v2) to get two results for one request to filter the traffic more accurately
Example:Request Blocking(PHP)(PHP)(API Mixed)
index.php
<?php
$email = 'xxx@abc.com';
$password = '12345678';
$allow_country=['US','CA'];
$allow_ip_score=100;
$allow_device=['desktop','tablet','mobile'];
$landing_page = 'landing_page.html';
$safe_page = 'safe_page.html';
session_start();
if (isset($_SESSION['trafficfilter_result'])){
if ($_SESSION['trafficfilter_result']) {
include($landing_page);
} else {
echo file_get_contents($safe_page);
}
}else{
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$data = request_trafficfilter([
'action' => 'get_replace',
'email' => $email,
'password' => $password,
]);
$content = file_get_contents($safe_page);
if (isset($data['search'][0]) && isset($data['replace'][0])){
$content = str_replace($data['search'],$data['replace'],$content);
}
echo $content;
} else {
$post_data=isset($_POST['_'])?$_POST['_']:'';
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_arr = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = $ip_arr[0];
} else{
$ip = $_SERVER['REMOTE_ADDR'];
};
$data = request_trafficfilter([
'action' => 'get_result',
'email' => $email,
'password' => $password,
'client_ip' =>$ip,
'identifier'=>$_SERVER['HTTP_HOST'],
'data'=>$post_data
]);
if ($data['fingerprint_result'] && $data['score']>=$allow_ip_score && in_array($data['country'],$allow_country) && in_array($data['device'],$allow_device)){
$_SESSION['trafficfilter_result']=true;
echo '1';
} else {
$_SESSION['trafficfilter_result']=false;
}
}
}
function request_trafficfilter($data){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://trafficfilter.io/mixed');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
$res = curl_exec($curl);
if (is_array(json_decode($res,true))){
$res = json_decode($res, true);
}else{
echo $res;
}
curl_close($curl);
return $res;
}
?>
landing_page.html
<!DOCTYPE html>
<html>
<head>
<title>Landing page</title>
</head>
<body>
Here is your Landing page
</body>
</html>
safe_page.html
<html>
<head>
<title>Access denied</title>
</head>
<body>
Your request has been denied.
</body>
</html>
Trafficfilter.io v2 API Document
Why Fingerprint
In web requests, browser fingerprint has strong uniqueness and high accuracy rate
In V2 version, we use browser fingerprint as recognition signal
Example:Request Blocking(PHP)(API v2)
index.php
<?php
$email = 'xxx@abc.com';
$password = '12345678';
$allow_device=['desktop','tablet','mobile'];
$landing_page = 'landing_page.html';
$safe_page = 'safe_page.html';
session_start();
if (isset($_SESSION['trafficfilter_result'])){
if ($_SESSION['trafficfilter_result']) {
include($landing_page);
} else {
echo file_get_contents($safe_page);
}
}else{
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
$data = request_trafficfilter([
'action' => 'get_replace',
'email' => $email,
'password' => $password,
]);
$content = file_get_contents($safe_page);
if (isset($data['search'][0]) && isset($data['replace'][0])){
$content = str_replace($data['search'],$data['replace'],$content);
}
echo $content;
} else {
$post_data=isset($_POST['_'])?$_POST['_']:'';
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_arr = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = $ip_arr[0];
} else{
$ip = $_SERVER['REMOTE_ADDR'];
};
$data = request_trafficfilter([
'action' => 'get_result',
'email' => $email,
'password' => $password,
'data'=>$post_data
]);
if ($data['fingerprint_result'] && in_array($data['device'],$allow_device)){
$_SESSION['trafficfilter_result']=true;
echo '1';
} else {
$_SESSION['trafficfilter_result']=false;
}
}
}
function request_trafficfilter($data){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://trafficfilter.io/v2');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data));
$res = curl_exec($curl);
if (is_array(json_decode($res,true))){
$res = json_decode($res, true);
}else{
echo $res;
}
curl_close($curl);
return $res;
}
?>
landing_page.html
<!DOCTYPE html>
<html>
<head>
<title>Landing page</title>
</head>
<body>
Here is your Landing page
</body>
</html>
safe_page.html
<html>
<head>
<title>Access denied</title>
</head>
<body>
Your request has been denied.
</body>
</html>
Trafficfilter.io v1 API Document
Quick Start
Request Example:
curl https://trafficfilter.io/v1 -X POST -d 'email=abc@abc.com&password=Your Password&ip=8.8.8.8&identifier=domain.com'
Name | Type | Mandatory | Description |
---|---|---|---|
String | true | Trafficfilter.io Username | |
password | String | true | Trafficfilter.io Password |
ip | String | true | Client Ip Address |
identifier | String | false | website domain |
Response:
{
"ip":"8.8.8.8",
"country":"US",
"score":100
}
Parameters:
Name | Type | Description |
---|---|---|
ip | String | ip address |
country | String | IP-GEO Country Code |
score | Integer | Credible Score(max:100;min:0) |
Score Explain
Trafficfilter.io will return a real person probability score of 0-100
Score range | Explain |
---|---|
86-100 | The probability of a real person is very high. |
71-85 | IP address has suspicious behavior, probably real person. |
0-70 | IP has abnormal behavior, low probability of real person. |
Example applications:Request Blocking - PHP(Cloak the real landing page)
index.php
<?php
$email = 'xxx@abc.com';
$password = '12345678';
$allow_country = ['US', 'CA'];
$allow_score=75;
if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
$ip = $_SERVER['HTTP_CF_CONNECTING_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip_arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$ip = $ip_arr[0];
} else {
$ip = $_SERVER['REMOTE_ADDR'];
};
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://trafficfilter.io/v1');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query([
'email' => $email,
'password' => $password,
'ip' => $ip,
'identifier' => $_SERVER['HTTP_HOST']
]));
$res = json_decode(curl_exec($curl), true);
curl_close($curl);
if (in_array($res['country'], $allow_country) && $res['score'] >= $allow_score) {
include('landing_page.html');
} else {
include('safe_page.html');
}
?>
*The 'US', 'CA' and "75" in the example code are reference values, please adjust according to the actual situation
*Better than most "Cloak" Tools if judgement score >= 95
landing_page.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Landing Page</title>
</head>
<body>
Here is your landing page
</body>
</html>
safe_page.html
<html lang="en">
<head>
<title>Access denied</title>
</head>
<body>
Your request has been denied, access is only allowed for real people from Japan
</body>
</html>