WordPress.com API key to use this service. You can review the spam it catches under "Manage" and it automatically deletes old spam after 15 days. Hat tip: Michael Hampton and Chris J. Davis for help with the plugin. Author: Matt Mullenweg Version: 1.12 Author URI: http://photomatt.net/ */ $wp_api_key = "XXXXXXXX"; // ENTER YOUR WORDPRESS API KEY HERE $ksd_api_host = $wp_api_key . '.rest.akismet.com'; $ksd_api_port = 80; $ksd_user_agent = "PixelPost/1.4.3 | Akismet/1.12"; $auto_comment_approved = 'none'; // Returns array with headers in $response[0] and entity in $response[1] function ksd_http_post($request, $host, $path, $port = 80) { global $ksd_user_agent; $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=iso8859-1\r\n"; $http_request .= "Content-Length: " . strlen($request) . "\r\n"; $http_request .= "User-Agent: $ksd_user_agent\r\n"; $http_request .= "\r\n"; $http_request .= $request; $response = ''; if( false !== ( $fs = @fsockopen($host, $port, $errno, $errstr, 3) ) ) { fwrite($fs, $http_request); while ( !feof($fs) ) $response .= fgets($fs, 1160); // One TCP-IP packet fclose($fs); $response = explode("\r\n\r\n", $response, 2); } return $response; } function ksd_auto_check_comment( $comment ) { global $auto_comment_approved, $ksd_api_host, $ksd_api_port; $comment['user_ip'] = $_SERVER['REMOTE_ADDR']; $comment['user_agent'] = $_SERVER['HTTP_USER_AGENT']; $comment['referrer'] = $_SERVER['HTTP_REFERER']; $ignore = array( 'HTTP_COOKIE' ); foreach ( $_SERVER as $key => $value ) if ( !in_array( $key, $ignore ) ) $comment["$key"] = $value; $query_string = ''; foreach ( $comment as $key => $data ) $query_string .= $key . '=' . urlencode( stripslashes($data) ) . '&'; $response = ksd_http_post($query_string, $ksd_api_host, '/1.1/comment-check', $ksd_api_port); if ( 'true' == $response[1] ) { $auto_comment_approved = 'spam'; } return $comment; } ?>