Download the PHP package cleantalk/php-checkbot without Composer
On this page you can find all versions of the php package cleantalk/php-checkbot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cleantalk/php-checkbot
More information about cleantalk/php-checkbot
Files in cleantalk/php-checkbot
Package php-checkbot
Short Description The best app to filter bots during the simple page viewing
License GPL-3.0-or-later
Informations about the package php-checkbot
This guideline will help you to use CleanTalk check_bot API method via the special library that can be downloaded from this repo.
Usage
- Install the package via composer
composer install cleantalk/php-checkbot
- Include the composer autoloader into your app
require_once 'vendor/autoloader.php';
-
Add the CleanTalk Bot-detector JS library wrapper
https://fd.cleantalk.org/ct-bot-detector-wrapper.jsas<script>tag to the HTML page contains the form you want to protect. -
Prepare config and create a new CleanTalk\CheckBot object, provide $_POST or filtered POST data to the constructor.
-
Then perform the check:
-
Then do the actions depending on the verdict.
- How it looks in the suggested files structure:
index.html:
your_form_handler.php:
Config setup explanation
Available config array elements
Common params
access_key (string)
Your CleanTalk Anti-Spam access key.trust_cleantalk_decision (bool)
Set this to true if you do not want to set custom checking settings. Applicable in the most cases.block_no_js_visitors (bool)
Set this to true if you want to block any visitor that could not execute JS script (bot-like behavior). Applicable in the most cases.common_block_message (string)
A message for blocked visitor.do_log (bool)
Set to true if you want to see the log in the PHP error log, false otherwise.
Custom params
Params below affected only if the property "trust_cleantalk_decision is set to false.
bot_expectation
Set maximum bot probability percentage. For example, 0.5 is 50%. If CleanTalk API responsed with bot_expectation 0.53 - visitor will be blocked, if 0.47 - passed.ip_frequency_24hour,ip_frequency_1hour,ip_frequency_10min
Custom checks - set how to block a visitor whose IP address detected by CleanTalk service in the period. For example, if CleanTalk response contains ip_frequency_24hour = 1000, and the config property ip_frequency_24hour = 500, visitor will be blocked.
How to test
- Disable JavaScript implementation in your web-browser. If the param
trust_cleantalk_decisionis set totrue, you are blocked when you try to send the form. - Install the solution on a dev site with visiting opened. Then set the param
do_logtotrue. You will see how the CheckBot works in the PHP error log.
Examples
Examples of the form with CheckBot integrated can be found in the /examples folder. Note: the examples does not contain the lib itself.