PluginProbe
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell / 3.12.3
WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell v3.12.3
3.13.3 3.13.2 3.13.1 3.13.0 3.12.13 3.12.12 3.12.11 3.12.10 3.12.9 3.12.8 3.12.7 3.12.6 3.12.5 3.12.4 3.12.3 3.12.1 3.12.2 3.12.0 3.11.1 3.11.0 3.10.9 3.10.8 3.10.7 3.10.6 2.8.16 All 261 releases
wpfunnels / public / classes / class-wpfnl-recaptcha-handle.php

class-wpfnl-recaptcha-handle.php in WPFunnels – Funnel Builder for WooCommerce with Checkout & One Click Upsell 3.12.3, at public/classes/class-wpfnl-recaptcha-handle.php

43 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handle Recaptcha
4 *
5 * @package
6 */
7 namespace WPFunnels\Frontend\Recaptcha;
8
9 Class Google_Recaptcha_Handler{
10
11 /**
12 * Response G- Recaptcha
13 *
14 * @param string $secretKey
15 * @param $token
16 *
17 * @since 2.5.5
18 */
19 public static function get_response_recaptcha( $secretKey = '', $token ){
20 $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR']: null;
21 $url = "https://www.google.com/recaptcha/api/siteverify";
22 $data = array('secret' => $secretKey, 'response' => $token, 'remoteip'=> $ip);
23
24 $query = http_build_query($data);
25 $options = array(
26 "ssl"=>array(
27 "verify_peer"=>false,
28 "verify_peer_name"=>false,
29 ),
30 'http' => array(
31 'header' => "Content-Type: application/x-www-form-urlencoded\r\n".
32 "Content-Length: ".strlen($query)."\r\n".
33 "User-Agent:MyAgent/1.0\r\n",
34 'method' => "POST",
35 'content' => $query,
36 ),
37 );
38 $context = stream_context_create($options);
39 $result = file_get_contents($url, false, $context);
40 return json_decode($result);
41 }
42 }
43