Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/250.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在iPage主机上,reCaptcha始终返回false_Php_Recaptcha - Fatal编程技术网

Php 在iPage主机上,reCaptcha始终返回false

Php 在iPage主机上,reCaptcha始终返回false,php,recaptcha,Php,Recaptcha,我有一个recaptcha,它不会在特定的网站上工作,我不知道为什么。在我的主机上,它工作正常,但当我在iPage主机上测试时,它总是返回false,即使使用简单的测试表单,它也总是false 我试过重新做钥匙。我甚至制作了最基本的表单,如下面所示,但总是返回false。没有错误 form.html <html> <head> <script src='https://www.google.com/recaptcha/api.js'></scr

我有一个recaptcha,它不会在特定的网站上工作,我不知道为什么。在我的主机上,它工作正常,但当我在iPage主机上测试时,它总是返回false,即使使用简单的测试表单,它也总是false

我试过重新做钥匙。我甚至制作了最基本的表单,如下面所示,但总是返回false。没有错误

form.html

<html>
<head>
    <script src='https://www.google.com/recaptcha/api.js'></script>
</head>
<body>
    <form action="test-recaptcha.php" method="post">
        <div class="g-recaptcha" data-sitekey="6LdXvCYTAAAAAOzMaqHb6lFZrIVnATbo7PxzvSfS"></div>
        <input type="submit" value="SUBMIT" id="submit">
    </form>
</body>
</html>

问题在于iPage使用的默认php.ini文件

“allow_url_fopen”默认设置为off,将其更改为on,一切都会正常工作

要更改此设置,请转到: cPanel>CGI和脚本语言支持>PHP脚本

<?php

require_once "recaptchalib.php";

$secret = "<<SECRET>>";

$response = null;
$reCaptcha = new ReCaptcha($secret);

if ($_POST['g-recaptcha-response']) {
    $response = $reCaptcha->verifyResponse(
        $_SERVER["REMOTE_ADDR"],
        $_POST['g-recaptcha-response']
    );
}

var_dump($response);
var_dump($_POST);
{["success"]=> bool(false) ["errorCodes"]=> NULL }