jeudi 26 mars 2015

reCAPTCHA form is returning an error

I have a simple Recaptcha included in my form, and it's giving me this error: Use of undefined constant success - assumed 'success'


I've looked at the documentation, and I've included all the necessary components of the integration. When I submit my form I still receive the same error.


Thanks for the help! :)


Here's my code:


PHP:



// reCAPTCHA
$captcha = isset($_POST['g-recaptcha-response']) ? $_POST['g-recaptcha-response'] : "";

if (empty($captcha)) {
echo "Please check the reCAPTCHA.";
}
$response = file_get_contents("http://ift.tt/1IxPp4e" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
if ($response.success == true) {
echo "It worked";
}


HTML:



<form action="contact.php" method="post">
<input name="name" type="text" class="form-control" />
<div class="g-recaptcha" data-sitekey="removed_for_demonstration"></div>
<input type="submit" name="contact" value="SUBMIT GAME" />
</form>

Aucun commentaire:

Enregistrer un commentaire