Hi all,

I'm trying to use the Akismet PHP5 plugin to stop spam on my website (not WordPress site) which is using a standard form.

Not sure if I'm setting this up correctly or not, can't seem to find much if any documentation around for it, plus the authors website no longer appears to exist, only the info in Github is available. Anyways, not sure if the fields such as telephone, department, comment1 and comment2 all should go through SetCommentContent or not? Any help/advice on any of my code would be appreciated. Not sure if I'm running tests/checks on this okay as well.

PHP Code:

require_once ('classes/Akismet.class.php');
$akismet = new Akismet"http://localhost/akismet-form""API key to go here");

// checks if key is valid
if($akismet->isKeyValid()) {
// api key is okay
} else {
'Akismet key is invalid';

if (isset(
$_POST['submit'])) {

// assign variable
$name $_POST['name'];
$department $_POST['department'];
$url $_POST['url'];
$email $_POST['email'];
$telephone $_POST['telephone'];
$comment1 $_POST['comment1'];
$comment2 $_POST['comment2'];

// run variables through Akismet function
$akismet->setCommentAuthor$name );
$akismet->setCommentAuthorURL$url );
$akismet->setCommentAuthorEmail$email );

// run everything that doesn't have a specifc class for it through CommentContent
$akismet->setCommentContent"$department $telephone $comment1 $comment2);

// spam check
if( $akismet->isCommentSpam() )
'This email contains spam!';


$to      'myemail@test.com';
$subject 'Akismet test';
$message =  'All content goes in here';
$headers 'From: webmaster@mysite.com' "\r\n" .
'Reply-To: webmaster@mysite.com' "\r\n" .
'X-Mailer: PHP/' phpversion();


// check if email sent
"Message Sent";
        } else {
"Message Not Sent";




<!DOCTYPE html>
<html dir="ltr">
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0" />
    <meta name="description" content="" />
        <link rel="stylesheet" href="css/style.css" />
        <!--[if lt IE 9]>
            <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>

    <main role="main">

        <form action="" method="post">

                    <label for="name">Name</label>
                    <input type="text" id="name" name="name" value="" />
                    <label for="department">Department</label>
                    <input type="text" id="department" name="department" value="" />
                    <label for="url">URL</label>
                    <input type="text" id="url" name="url" value="" />
                    <label for="email">Email</label>
                    <input type="text" id="email" name="email" value="" />
                    <label for="telephone">Telephone</label>
                    <input type="text" id="telephone" name="telephone" value="" />
                    <label for="comment1">Comment 1</label>
                    <textarea id="comment1" name="comment1" cols="20" rows="4"></textarea>
                    <label for="comment2">Comment 2</label>
                    <textarea id="comment2" name="comment2" cols="20" rows="4"></textarea>
                    <input type="submit" name="submit" value="Submit" />