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
session_start();
$apikey = '';
$email_field = 'name_email_form_field';
$user_name_field = 'name_user_name_form_field';
$message_field = 'name_message_form_field';
$type_form = 'contact'; // use 'signup' for user signup form
// if downloaded, unzip and include the app, take your own relative path:
sult) { // the check fired
if ($api_result->account_status !== 1) {
// something wrong with your key or license, to know why read $api_result->codes
echo 'Allowed. Spam protection disabled.'; // or do nothing
} else {
if ($api_result->allow === 1) {
echo 'Allowed. Spam protection OK.'; // or do nothing
} else {
die('Blocked. Spam protection OK. Reason: ' . $api_result->comment); // or make your own handler
}
}
}
// your further code flow here