【问题标题】:Google ReCaptcha : Name or service not knownGoogle ReCaptcha:名称或服务未知
【发布时间】:2018-02-27 02:50:49
【问题描述】:

尝试在我的联系表单上添加 reCaptcha 时,我收到此错误:

警告:file_get_contents(): php_network_getaddresses: getaddrinfo 失败:第 79 行的 *******/MyClass.php 中的名称或服务未知

$secret = "*********************";
$response = $_POST['g-recaptcha-response'];
$remoteip = $_SERVER['REMOTE_ADDR'];
$api_url = "https://www.google.com/recaptcha/api/siteverify?secret=" . $secret. "&response=" . $response. "&remoteip=" . $remoteip ;
$decode = json_decode(file_get_contents($api_url), true);

第 79 行是“$decode = json_decode(file_get_contents($api_url), true);” 我检查了我的 php.ini,allow_url_fopen = ON。 所以..无法弄清楚出了什么问题。有什么想法吗?

【问题讨论】:

  • print_r(gethostbyname('www.google.com')); 的输出是什么?
  • @EduardoEscobar 这是“www.google.com”
  • @j08691Hmm 好的,所以根据您的说法,这是一个“基础设施”问题?我将与我的系统管理员分享它

标签: php recaptcha


【解决方案1】:

我在 DNS 设置上苦苦挣扎了一段时间,然后才发现 http 只需要重新启动即可踢 php:

service httpd restart

recaptcha 现在又可以工作了。

【讨论】:

    猜你喜欢
    • 2016-11-10
    • 2013-08-08
    • 2016-01-06
    • 2019-07-07
    • 1970-01-01
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多