gglcptch_get_response

The Google Captcha (reCAPTCHA) by BestWebSoft gglcptch get response function.

Description

gglcptch_get_response( $privatekey, $remote_ip ); 

Parameters (2)

0. $privatekey
The privatekey.
1. $remote_ip
The remote ip.

Usage

  1. if ( !function_exists( 'gglcptch_get_response' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-captcha-recaptcha-by-bestwebsoft/google-captcha.php'; 
  3.  
  4. // The privatekey. 
  5. $privatekey = null; 
  6.  
  7. // The remote ip. 
  8. $remote_ip = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = gglcptch_get_response($privatekey, $remote_ip); 
  12.  

Defined (1)

The function is defined in the following location(s).

/google-captcha.php  
  1. function gglcptch_get_response( $privatekey, $remote_ip ) { 
  2. $args = array( 
  3. 'body' => array( 
  4. 'secret' => $privatekey,  
  5. 'response' => stripslashes( esc_html( $_POST["g-recaptcha-response"] ) ),  
  6. 'remoteip' => $remote_ip,  
  7. ),  
  8. 'sslverify' => false 
  9. ); 
  10. $resp = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', $args ); 
  11. return json_decode( wp_remote_retrieve_body( $resp ), true );