donglu5728 2015-09-23 08:41
浏览 126

无法从谷歌recaptcha得到回应

I am working in an application by using codeigniter framework back end as mysql. In login page I am trying to apply Google recaptcha as given by recaptcha.

For this i have added curl.php library in application/library given by codeigniter-curl

and in my controller I am writing following code

$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!!');
  }

in controller I am adding following libraries

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

But unable to get response from

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

I am not getting what I am missing in my code. please guide me for above issue.

  • 写回答

1条回答 默认 最新

  • dtrj74376 2015-10-23 22:37
    关注

    You can use curl errors to gather more information about the root cause of the error.

    if(curl_errno($c))
    {
        echo 'error:' . curl_error($c);
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探