/*
* Handling user-posted comments
*/
'author' => 'Test Author',
'authorEmail' => 'test@example.com',
'authorUri' => 'http://example.com/',
'content' => 'Hello, World!'
));
try {
$apiKey = 'AABBCCDDEEFF';
if ($akismet->isSpam($comment)) {
// rather than simply ignoring the spam comment, it is recommended
// to save the comment and mark it as spam in case the comment is a
// false positive.
} else {
// save comment as normal comment
}
echo 'Invalid API key!';
echo 'Error communicating with Akismet API server: ' .
$httpException->getMessage();
echo 'Specified comment is missing one or more required fields.' .
$commentException->getMessage();
}
/*
* Submitting a comment as known spam
*/
'author' => 'Test Author',
'authorEmail' => 'test@example.com',
'authorUri' => 'http://example.com/',
'content' => 'Hello, World!'
));
try {
$apiKey = 'AABBCCDDEEFF';
echo 'Invalid API key!';
echo 'Error communicating with Akismet API server: ' .
$httpException->getMessage();
echo 'Specified comment is missing one or more required fields.' .
$commentException->getMessage();
}
/*
* Submitting a comment as a false positive
*/
'author' => 'Test Author',
'authorEmail' => 'test@example.com',
'authorUri' => 'http://example.com/',
'content' => 'Hello, World!'
));
try {
$apiKey = 'AABBCCDDEEFF';
echo 'Invalid API key!';
echo 'Error communicating with Akismet API server: ' .
$httpException->getMessage();
echo 'Specified comment is missing one or more required fields.' .
$commentException->getMessage();
}