【发布时间】:2017-07-26 03:29:05
【问题描述】:
我有一个用于发送带有recaptcha 的电子邮件的表格,当我使用我在recaptcha 常见问题解答中找到的测试站点密钥和密钥时,一切正常 recaptcha faq
但是当我插入它时它不起作用,我也尝试过重新创建密钥但问题仍然存在......有什么建议吗? 这是我的 PHP 代码:
<?php
$response = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=MY_SECRET_KEY&response='.$_POST['g-recaptcha-response'].'&remoteip='.$_SERVER['REMOTE_ADDR']);
$responseDecoded = json_decode($response);
if ( $responseDecoded->success == false ) {
echo 'Busted!';
exit();
}
else{
//here I insert the code for sending email
}
?>
【问题讨论】:
-
您遇到了什么错误/问题
-
我会确认您是否可以 file_get_contents 其他 SSL/HTTPS 链接(考虑 openssl 问题)
-
你有什么错误吗?
-
从控制台我没有收到任何错误,但它仍然给我“失败!”
-
@Scuzzy 你认为是因为我的网站不在 ssl/https 上吗?