Skip to content

Instantly share code, notes, and snippets.

@nickdunn
Created July 10, 2009 16:41
Show Gist options
  • Save nickdunn/144607 to your computer and use it in GitHub Desktop.
Save nickdunn/144607 to your computer and use it in GitHub Desktop.
<?php
// comes from the Akismet extension
include_once(WORKSPACE . '/assets/akismet.curl.class.php');
$comment = array(
'comment_type' => 'comment',
'comment_author' => $_POST['fields']['author'],
'comment_author_email' => $_POST['fields']['email'],
'comment_author_url' => $_POST['fields']['url'], // this might be optional?
'comment_content' => implode($_POST['fields']),
'permalink' => URL . $_REQUEST['page']
);
/*
Sign up for an API key at Wordpress. Key is under My Profile at the top o' the page. Easy to miss!
http://wordpress.com/wp-login.php
user: ...
pass: ...
*/
$akismet = new akismet("API KEY HERE", URL);
if(!$akismet->error) {
if ($akismet->is_spam($comment)) {
return;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment