Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php google reCAPTCHA不使用codeigniter_Php_Codeigniter_Validation_Recaptcha - Fatal编程技术网

Php google reCAPTCHA不使用codeigniter

Php google reCAPTCHA不使用codeigniter,php,codeigniter,validation,recaptcha,Php,Codeigniter,Validation,Recaptcha,我正在尝试为我的网站联系人表单设置一个google recaptcha。但这对我不起作用。请帮忙 我的查看页面 <div class="g-recaptcha" data-sitekey="My_SITE_KEY" ></div> 控制器 public function send() { $this->load->library('curl'); $this->load->librar

我正在尝试为我的网站联系人表单设置一个google recaptcha。但这对我不起作用。请帮忙

我的查看页面

<div class="g-recaptcha" data-sitekey="My_SITE_KEY" ></div>

控制器

public function send()
        {
          $this->load->library('curl'); 
          $this->load->library('session');
          $this->load->helper(array('form', 'url'));
                    $recaptchaResponse = trim($this->input->post('g-recaptcha-response'));
                    $userIp=$this->input->ip_address();
                    $secret='Secret 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']){  

        $config = array(        
                  'mailtype' => 'html',
                  'charset'  => 'utf-8',
                  'priority' => '1'
                   );


       $this->load->library('email',$config); 


                  $from_email = "yy@demo.com"; 
                  $to_email = "xx@demo.co.in"; 


        $message = '<html><body>';
        $message .= "<tr><td><strong>Email:</strong> </td><td>" . $this->input->post('email'). "</td></tr>";
        $message .= "<tr><td><strong>Message:</strong> </td><td>" . $this->input->post('message'). "</td></tr>";




         $this->email->from($from_email, 'demo'); 
         $this->email->to($to_email);
         $this->email->subject('Contact Info'); 
         $this->email->message($message); 
         $this->email->send()
         $this->session->set_flashdata('msg', 'Success..!');
         redirect($_SERVER['HTTP_REFERER']);


}else{
$this->session->set_flashdata('msg', 'Error...! Google Recaptcha UnSuccessful');
redirect($_SERVER['HTTP_REFERER']);
}
}
公共函数send()
{
$this->load->library('curl');
$this->load->library('session');
$this->load->helper(数组('form','url');
$recaptchaResponse=trim($this->input->post('g-recaptcha-response'));
$userIp=$this->input->ip_address();
$secret='secret key';
$url=”https://www.google.com/recaptcha/api/siteverify?secret=“$secret.”&response;=“$recaptchaResponse.”&remoteip;=”$userIp;
$response=$this->curl->simple\u get($url);
$status=json_decode($response,true);
如果($status['success']){
$config=数组(
“邮件类型”=>“html”,
“字符集”=>“utf-8”,
“优先级”=>“1”
);
$this->load->library('email',$config);
$from_电子邮件=”yy@demo.com"; 
$to_电子邮件=”xx@demo.co.in"; 
$message='';
$message.=“电子邮件:”$this->input->post('Email');
$message.=“消息:”$this->input->post('message');
$this->email->from($from_email,'demo');
$this->email->to($to_email);
$this->email->subject('Contact Info');
$this->email->message($message);
$this->email->send()
$this->session->set_flashdata('msg','Success..!');
重定向($_服务器['HTTP_REFERER']);
}否则{
$this->session->set_flashdata('msg','Error…!Google Recaptcha UnSuccessful');
重定向($_服务器['HTTP_REFERER']);
}
}
我总是收到闪光信息

错误。。。!谷歌重演失败

当我打印响应时
Print\r($response);退出

{“成功”:false,“错误代码”:[“缺少输入响应”]}


删除
来自
“&response;=”$recaptchaResponse。“&remoteip;=”$userIp…谢谢@Lawrence\u Cherone。您保存了meremove
来自
“&response;=”$recaptchaResponse。“&remoteip;=”$userIp…谢谢@Lawrence\u Cherone。你救了我