Я пытаюсь автоматически перенаправить пользователя на URL после успешного выполнения ReCaptcha.
<?php
require('src/autoload.php');
$siteKey = 'my-site-key';
$secret = 'my-secret-key';
$recaptcha = new \ReCaptcha\ReCaptcha($secret);
$gRecaptchaResponse = $_POST['g-recaptcha-response']; //google captcha post data
$remoteIp = $_SERVER['REMOTE_ADDR']; //to get user's ip
$recaptchaErrors = ''; // blank varible to store error
$resp = $recaptcha->verify($gRecaptchaResponse, $remoteIp); //method to verify captcha
if ($resp->isSuccess()){
header('Location: http://www.theurl.com/'); //this is where it should redirect to
exit;
}
else {
$recaptchaErrors = $resp->getErrorCodes(); // set the error in varible
}
?>
Я искал почти весь Google, но безрезультатно.