PHP code example of cleantalk / php-antispam
1. Go to this page and download the library: Download cleantalk/php-antispam 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-antispam example snippets
composer
$apikey = ''; // get it here cleantalk.org (free trial)
$email_field = $_POST['email']; // get it from your form
$cleantalk_antispam = new CleantalkAntispam($apikey, $email_field);
$api_result = $cleantalk_antispam->handle();
if ($api_result && $api_result->allow === 0) {
die('Blocked. Spam protection OK. Reason: ' . $api_result->comment);
// or make your own actions/logs/messages ...
}
// TROUBLESHOOTING: logging the suggestions
error_log($cleantalk_antispam->whatsWrong(true));