无法从谷歌recaptcha得到回应

时间:2015-09-23 08:41:44

标签: php mysql codeigniter curl recaptcha

我正在使用codeigniter框架后端作为mysql在应用程序中工作。在登录页面中,我正在尝试应用recaptcha给出的Google recaptcha。

为此,我在codeigniter-curl

给出的应用程序/库中添加了curl.php库

在我的控制器中我正在编写以下代码

$recaptchaResponse = trim($this->input->post('g-recaptcha-response'));
$userIp=$this->input->ip_address();
$secret='MY_KEY';
$url="https://www.google.com/recaptcha/api/siteverify?secret=".$secret."&response;=".$recaptchaResponse."&remoteip;=".$userIp;
$response = $this->curl->simple_get($url);
$status= json_decode($response, true);
if($status['success']){    
   $this->session->set_flashdata('flashSuccess', 'Google Recaptcha Successful');
  }else{
   $this->session->set_flashdata('flashSuccess', 'Sorry Google Recaptcha Unsuccessful!!');
  }

在控制器中我正在添加以下库

$this->load->library('curl');
$this->load->library('javascript');
$this->load->library('javascript/jquery');

但无法得到回应

$this->curl->simple_get($url); 

我没有得到我在代码中遗漏的内容。请指导我以上问题。

1 个答案:

答案 0 :(得分:0)

您可以使用curl错误来收集有关错误根本原因的更多信息。

if(curl_errno($c))
{
    echo 'error:' . curl_error($c);
}
相关问题