I have been looking for what I might be doing wrong and for solutions all over but none seem to rectify my problem. I have a form with a recaptcha, it is pretty simple. But my recaptcha validation fails every time and echo's "Not successful" when it should be successful. What am I doing wrong? Here is my code.
<?php require_once('src/autoload.php'); require_once('src/ReCaptcha/ReCaptcha.php'); require_once('src/ReCaptcha/RequestMethod.php'); require_once('src/ReCaptcha/RequestParameters.php'); require_once('src/ReCaptcha/Response.php'); require_once('src/ReCaptcha/RequestMethod/Post.php'); require_once('src/ReCaptcha/RequestMethod/Socket.php'); require_once('src/ReCaptcha/RequestMethod/SocketPost.php'); require_once('src/ReCaptcha/RequestMethod/Curl.php'); require_once('src/ReCaptcha/RequestMethod/CurlPost.php'); $gRecaptchaResponse = $_POST['g-recaptcha-response']; $remoteIp = $_SERVER['REMOTE_ADDR']; $SITEKEY = 'XXXX'; $secret = 'XXXX'; $recaptcha = new \ReCaptcha\ReCaptcha($secret); $resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp); if ($resp->isSuccess()) { echo "success"; } else { $errors = $resp->getErrorCodes(); echo "not success"; echo $errors; } ?>