1. Go to this page and download the library: Download cleantalk/php-checkbot 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/ */
cleantalk / php-checkbot example snippets
$check_bot_config = array(
'access_key' => "YOUR-CLEANTALK-API-KEY"
);
$config = new \Cleantalk\CheckBot\CheckBotConfig($check_bot_config);
$bot_checker = new \Cleantalk\CheckBot\CheckBot($config, $_POST);
$is_bot = $bot_checker->check()->getVerdict();
if ( $is_bot ) {
die ($bot_checker->getBlockMessage());
}
empty($_POST) ) {
return;
} else {
handle_search_form($_POST);
}
/**
* Main search from handler.
* @param $post
* @return void
*/
function handle_search_form($post)
{
if ( empty($post['search_field']) ) {
return;
}
//create a new CheckBot object
$check_bot_config = array(
'access_key' => "YOUR-CLEANTALK-API-KEY"
);
$config = new \Cleantalk\CheckBot\CheckBotConfig($check_bot_config);
$bot_checker = new \Cleantalk\CheckBot\CheckBot($config, $_POST);
//call visitor check and make decision
$is_bot = $bot_checker->check()->getVerdict();
if ( $is_bot ) {
die ($bot_checker->getBlockMessage());
}
//implement your further search form handlers here replacing echo
echo('You searched for this: ' . $post['search_field']);
}
$check_bot_config = array(
'access_key' => "",
'trust_cleantalk_decision' => true,
'block_no_js_visitors' => false,
'common_block_message' => 'Visitor blocked. It seems to be a bot.',
'bot_expectation' => 0.5,
'ip_frequency_24hour' => 50,
'ip_frequency_1hour' => 15,
'ip_frequency_10min' => 5,
'do_log' => false
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.