0

html file redirects to php page called index.php and index.php is a recaptcha php file from google

<?php


require_once "recaptchalib.php";

// Register API keys at https://www.google.com/recaptcha/admin
$siteKey = "*";
$secret = "*";
// reCAPTCHA supported 40+ languages listed here: https://developers.google.com/recaptcha/docs/language
$lang = "en";

// The response from reCAPTCHA
$resp = null;
// The error code from reCAPTCHA, if any
$error = null;

$reCaptcha = new ReCaptcha($secret);

// Was there a reCAPTCHA response?
if ($_POST["g-recaptcha-response"]) {
    $resp = $reCaptcha->verifyResponse(
        $_SERVER["REMOTE_ADDR"],
        $_POST["g-recaptcha-response"]
    );
}

 if ($resp != null && $resp->success) {
    require_once 'gmail.php';
    }else{
    header('Location: ../failed.html');
}

?>

When page loads it shows that the page took too long to respond. The webaddress is still example.com/php/index.php. I've done this on xampp and another website and it works. What could possibly be the reason? Do I need to contact the webhost?

is there are a way to know where in line of code the error occured?

edit: It has my siteKey and secretkey . I removed it in this case

a_bldmr
  • 47
  • 11

1 Answers1

2

To show php errors, put this at the top of your script:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Also try putting either:

exit();

or

die(); 

after your header('location...

Eric
  • 9,870
  • 14
  • 66
  • 102
UltrasoundJelly
  • 1,845
  • 2
  • 18
  • 32