Posted on 5/7/06 by Felix Geisendörfer
The authors of this post have marked it as deprecated. This means the information displayed is most likely outdated, inaccurate, boring or a combination of all three.
Policy: We never delete deprecated posts, but they are not listed in our categories or show up in the search anymore.
"Remember the days before spam", that's what it reads when you vist akismet.com, and I have to admit, no, I don't remember them ; ). Spam has been an issue for me ever since I got my first email adress. But nowdays spam scripts not only spam standardized applications like wordpress, no, they also try to figure out how to spam your personal contact/guesbook/whatever forms and are pretty good at it.
Here on ThinkingPHP.org, I get about 40~100 spam comments every day, tendency increasing. So at some point the manual deletion and blacklist filters didn't cut it any longer. Gladly, Daniel Hofstetter (Cake Baker) pointed me to a wonderful wordpress plugin called Akismet, which also is a service, dedicated to eliminate spam.
So far I've been really impressed with it. The plugin/service already filtered out 4149 spam comments for me, with no false-positives in them. Only 2 comments made it through their filters. That's a 99,95% accuracy. Truly Amazing! But now here is the best thing, their API is open to the public, and everybody can get a free key over at wordpress.com. However, if you are working on a commercial application you should checkout their restrictions / prices regarding the Commercial Use of API Keys.
Today I finally found the time to get around to write a CakePHP Web Model for their service. It bases on my Web Model class from the Web Model package I'm maintaining. Integration and usage are as simple as it get's. You just download the Web Model, put it in /app/web_model.php and then download the Akismet Model and put it in /app/models/akismet.php.
Now that you have done this, checking a comment for spam is as easy as this:
var $name = 'AkismetTest';
var $uses = array('Akismet');
$this->Akismet->apiKey = 'your-api-key';
$comment = array('comment_author' => 'Spammer Bob',
'comment_author_email' => 'email@example.com',
'comment_author' => 'Viagra rocks, dude!');
$result = $this->Akismet->checkComment($comment);
// If the comment is Spam, $result == 'true', if not
// $result == 'false'.
For a complete list of $comment options, see: http://akismet.com/development/api/#comment-check.
The Model also allows you to manually mark comments as spam and to report false positives. Just take a look at the code , it's pretty self explanatory I hope.
So, I'd be happy to get some feedback from those people who struggle(d) with spam on their (cakephp) sites like I did. Good Luck in the war against spam ; )!
--Felix Geisendörfer aka the_undefined
You can skip to the end and add a comment.
This post is too old. We do not allow comments here anymore in order to fight spam. If you have real feedback or questions for the post, please contact us.