Skip to content

Commit 2fb34dc

Browse files
committed
Ingore SSL verify
1 parent b3717b0 commit 2fb34dc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/AlexStack/GoogleRecaptchaToAnyForm/GoogleRecaptcha.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
/**
34
* Created by Alex Zeng
45
* 2019-06-25
@@ -40,7 +41,7 @@ public static function verify($secret_key, $break_msg = null, $recaptcha_score =
4041
* @param [type] $g_recaptcha_response
4142
* @return void
4243
*/
43-
public static function result($secret_key, $g_recaptcha_response, $recaptcha_score=0.5)
44+
public static function result($secret_key, $g_recaptcha_response, $recaptcha_score = 0.5)
4445
{
4546
$google_recaptcha_uri = 'https://www.google.com/recaptcha/api/siteverify';
4647

@@ -53,6 +54,7 @@ public static function result($secret_key, $g_recaptcha_response, $recaptcha_sco
5354
curl_setopt_array($curl, [
5455
CURLOPT_RETURNTRANSFER => true,
5556
CURLOPT_POST => true,
57+
CURLOPT_SSL_VERIFYPEER => false,
5658
CURLOPT_URL => $google_recaptcha_uri,
5759
CURLOPT_POSTFIELDS => [
5860
'secret' => $secret_key,
@@ -73,7 +75,7 @@ public static function result($secret_key, $g_recaptcha_response, $recaptcha_sco
7375

7476
if (!$response || $response->success == false) {
7577
return false;
76-
} else if ( isset($response->score) && $response->score < $recaptcha_score ) {
78+
} else if (isset($response->score) && $response->score < $recaptcha_score) {
7779
return false;
7880
} else {
7981
return true;
@@ -92,20 +94,20 @@ public static function result($secret_key, $g_recaptcha_response, $recaptcha_sco
9294
*/
9395
public static function show($site_key, $after_field_id = 'Form_ContactForm_Comment', $debug = 'no_debug', $extra_class = "mt-4 mb-4", $please_tick_msg = "Please tick the I'm not robot checkbox")
9496
{
95-
if ( $please_tick_msg == 'v3'){
97+
if ($please_tick_msg == 'v3') {
9698
return Self::showV3($site_key, $after_field_id, $debug, $extra_class);
9799
}
98100

99-
if ( strpos($extra_class, 'invisible') !== false ){
101+
if (strpos($extra_class, 'invisible') !== false) {
100102
return Self::showInvisible($site_key, $after_field_id, $debug, $extra_class);
101103
}
102104

103105
$api_js_str = "<script src='https://www.google.com/recaptcha/api.js'></script>";
104-
if ( strpos($extra_class, 'no-api-js') !== false ){
106+
if (strpos($extra_class, 'no-api-js') !== false) {
105107
$api_js_str = "";
106108
}
107109
$data_theme = 'light';
108-
if ( strpos($extra_class, 'theme-dark') !== false ){
110+
if (strpos($extra_class, 'theme-dark') !== false) {
109111
$data_theme = "dark";
110112
}
111113

@@ -170,7 +172,7 @@ public static function showV3($site_key, $after_field_id = 'Form_ContactForm_Com
170172
{
171173
$debug_mode = ($debug == 'no_debug') ? '' : 'return false; // debug mode is on ';
172174

173-
if ( strpos($extra_class, 'show-inline-badge') !== false ){
175+
if (strpos($extra_class, 'show-inline-badge') !== false) {
174176
$api_js = "https://www.google.com/recaptcha/api.js?render=explicit&onload=alexGetRecaptchaValue";
175177
$recaptcha_client = "var recaptchaClient = grecaptcha.render('CustomContactUsForm-inline-badge', {
176178
'sitekey': '$site_key',

0 commit comments

Comments
 (0)