Using my AntiSpam Library

TypePad + CodeIgniter
In another post, I gave a download link to my AntiSpam library. I wanted to officially release it, and I didnt get a chance to write a tutorial, but I was eager to release it, so I did anyway.

Anyway, here is a quick tutorial I promised.

Step One

First, you will need to unzip the script and extract it into your application/libraries folder. The next step is to get an API key for TypePad AntiSpam. This is really easy to get, you just have to go to This URL. You might have to sign up for an account, but its nothing major, and easy to do.

Step Two

Once you have an API key, you have two options. You can edit the script, and change the variable (Easy to find) $api_key to your API key. Or you can wait till step three. Then load the script by doing $this->load->library(”antispam”);

Step Three

Right! You are ready to run your script. There are four main functions that you will be using:

$this->antispam->set_api_key($key);

Set the API key to $key. Not needed if you have hardcoded it.

$this->antispam->check($user_ip, $author, $author_email, $author_url, $content);

Check the comment $content against the TypePad service. Requires the user ip, the author’s name, the author’s email, the author’s url and the content of the comment. Returns TRUE (bool) if the comment is spam, and FALSE (bool) if it’s not.

$this->antispam->submit_spam($user_ip, $author, $author_email, $author_url, $content);

If TypePad marks a comment as safe, and you find later that it is spamand the system made a mistake, run this function, and it will tell TypePad that it has made a mistake and this comment is in fact spam.

$this->antispam->submit_ham($user_ip, $author, $author_email, $author_url, $content);

The exact opposite of submit_spam, if a comment is marked as spam, but it is actually safe, run this.

That’s it!

Step Four

Use the code as provided. The next step would be to set up some kind of que so that you have a graphical way of checking for spam and ham. Enjoy having less spam :)

Thanks! Please use, and remember to keep checking up here for updates and stuff.

If you have any ideas/suggestions for the library, don’t forget to comment!

Comments:

Post a comment