1. Go to this page and download the library: Download coercive/botkicker 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/ */
coercive / botkicker example snippets
use Coercive\Security\BotKicker\UserAgentKicker;
# Get Instance
$kicker = new UserAgentKicker; // or othe kicker
# Load a default list
$kicker->loadCoerciveLists();
# or load custom list...
# Basic bot detection
if(!$kicker->detect()->getStatus()) {
echo 'a bot is detected';
}
else {
# True if in whitelist or not in blacklist
}
if($kicker->isRobotsTxtRequested()) { /* do something */ }
# You can (dis)allow empty current detection
$kicker->allowEmpty( true | false );
# HostKicker only
$kicker = new HostKicker;
# Set your ip list
$kicker->setHostFromIp( [
'xxx.xx.xx.x',
'yy.yyy.y.y',
'...',
] );
# Get auto Ip list detection
$list = (new IpKicker)->getCurrents();
# Set auto ip list
$kicker = new HostKicker;
$kicker->setHostFromIp($list);
# Get auto Ip list detection
$ipk = new IpKicker;
$list = $ipk->getFacebookList();
$list = $ipk->isBing('157.55.39.1', true | false); # Linux Host cmd (true) / NsLookUp (false)
# Example of custom datas
$datas = ['bot1', 'bot2', 'bot3'];
# Override auto detection
$kicker->setCurrents($datas);
# Show detection result
$status = $kicker->detect();
var_dump( $status->getList() );
# Example of custom datas
$datas = ['bot1', 'bot2', 'bot3'];
# Override auto detection
$kicker->setCurrents($datas);
# Show detection result
$status = $kicker->detect();
var_dump( $status->getStatus() ); # bool if ok or not
var_dump( $status->getList() ); # array list of match elements
var_dump( $status->getCurrents() ); # array current datas
use Coercive\Security\BotKicker\HostLookUp;
use Coercive\Security\BotKicker\NsLookUp;
$look = new HostLookUp;
# OR
$look = new NsLookUp;
$array = $look->getDomains('111.22.33.4');
use Coercive\Security\BotKicker\HostLookUp;
use Coercive\Security\BotKicker\NsLookUp;
$look = new HostLookUp;
# OR
$look = new NsLookUp;
$array = $look->getIps('www.example.com.');
use Coercive\Security\BotKicker\HostLookUp;
use Coercive\Security\BotKicker\NsLookUp;
$look = new HostLookUp;
# OR
$look = new NsLookUp;
# Match ip > domain
$array = $look->match('111.22.33.4', 'www.example.com.');
# OR mactch with reverse (match ip > domain first and domain > ip after)
$array = $look->match('111.22.33.4', 'www.example.com.', true);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.