【发布时间】:2015-11-21 23:31:03
【问题描述】:
我正在为我的网页使用 Google reCaptcha。
在测试模式下一切正常。没有 SSL。
当我在生产环境中测试我的网页时,出现以下错误:
警告:file_get_contents():SSL 操作失败并出现代码 1. OpenSSL错误信息:error:14090086:SSLroutines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed in /vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php 第 68 行
警告:file_get_contents(): 无法启用加密 /vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php 在 68
警告行: 文件获取内容(https://www.google.com/recaptcha/api/siteverify): 无法打开流:操作失败 /vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php 在线 68
["invalid-json"]
我这样调用 reCaptcha API:
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit"
async defer></script>
如谷歌开发者页面所述。
我在 hoststar.ch 托管我的网页。正在运行 TSL 1.2。
我希望有人可以帮助我。
【问题讨论】:
-
您是否通过 https 调用了 google javascript 文件?直播主机是否允许使用
file_get_contents获取网址? -
@RamRaider 第二个问题我不知道,得问hoststar
-
尝试使用
file_get_contents( 'http://example.com/' ),看看测试页面上会发生什么 - 在实时站点上。如果您收到响应,则主机允许使用 fopen 包装器,否则您可能需要重新考虑... -
@RamRaider 如果我发出 http 请求,它可以工作,如果我发出 https 请求,它就不起作用......我无法更改 reCaptcha API
标签: php ssl file-get-contents recaptcha