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
linenums="1"
$api_key = getenv('CLEANTALK_API_KEY');
if (empty($api_key)) {
throw new RuntimeException('CLEANTALK_API_KEY is not configured');
}
$email_field = $_POST['email']; // Get this value from your form.
$cleantalk_antispam = new CleantalkAntispam($api_key, $email_field);
// Set additional parameters here.
$api_result = $cleantalk_antispam->handle();
linenums="3"
...
// Set additional parameters here.
$cleantalk_antispam->setEventTokenEnabled(1);
...
if ($api_result && $api_result->allow === 0) {
die('Blocked. Spam protection OK. Reason: ' . $api_result->comment);
// Or add your own actions, logs, or messages.
}