php ReCaptcha - 无法打开套接字

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19055472/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 18:44:03  来源:igfitidea点击:

ReCaptcha - Could not open socket

phpformssocketscaptcharecaptcha

提问by Ridz

Before I ask this question, let me mention I know there are several of the exact same questions on the site but I am afraid they can't help me out.

在我问这个问题之前,让我提一下,我知道网站上有几个完全相同的问题,但我担心他们帮不了我。

Hi,

你好,

Yesterday my ReCaptcha was working fine but now it's not. I am using the library provided by Google and using the proper code. I did not change any code since yesterday so it should still work. However, when I try to submit the form now the page returns Could not open socket.

昨天我的 ReCaptcha 工作正常,但现在不是了。我正在使用 Google 提供的库并使用正确的代码。自昨天以来我没有更改任何代码,所以它应该仍然有效。但是,当我现在尝试提交表单时,页面返回Could not open socket.

Edit: I just checked and fsockopenis enabled on my server.

编辑:我刚刚检查并fsockopen在我的服务器上启用。

回答by Antony Harder

I came into same issue, but all the alternative host names I googled already don't work. A very good advice that helped me was from Recaptcha google group

我遇到了同样的问题,但我用谷歌搜索的所有备用主机名都不起作用。一个对我有帮助的非常好的建议来自Recaptcha google group

Use:

用:

define("RECAPTCHA_VERIFY_SERVER", gethostbyname("www.google.com"))

Works just fine for me.

对我来说很好用。

回答by Ridz

Changed the following:

更改了以下内容:

define("RECAPTCHA_VERIFY_SERVER", "www.google.com");

to

define("RECAPTCHA_VERIFY_SERVER", "74.125.227.48");

Now it works. This is to be edited in the captcha lib php file recaptchalib.php.

现在它起作用了。这将在验证码 lib php 文件中进行编辑recaptchalib.php

回答by Diego

Open your cmd and type: ping www.google.com The google server replay: Replay from xxx.xxx.xx.xxx ... take the ip

打开你的cmd并输入:ping www.google.com google server replay: Replay from xxx.xxx.xx.xxx ... take the ip

Edit your recaptchalib.php

编辑你的 recaptchalib.php

At the line

在一线

define("RECAPTCHA_VERIFY_SERVER", "www.google.com");

定义(“RECAPTCHA_VERIFY_SERVER”,“www.google.com”);

replace the www.google.com with the google IP address

将 www.google.com 替换为 google IP 地址

define("RECAPTCHA_VERIFY_SERVER", xxx.xxx.xxx.xxx);

定义(“RECAPTCHA_VERIFY_SERVER”,xxx.xxx.xxx.xxx);