Search
 
SCRIPT & CODE EXAMPLE
 

PHP

recaptcha v3 PHP

if (isset($_POST['g-recaptcha-response'])) {
    $captcha = $_POST['g-recaptcha-response'];
} else {
    $captcha = false;
}

if (!$captcha) {
    //Do something with error
} else {
    $secret   = 'Your secret key here';
    $response = file_get_contents(
        "https://www.google.com/recaptcha/api/siteverify?secret=" . $secret . "&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']
    );
    // use json_decode to extract json response
    $response = json_decode($response);

    if ($response->success === false) {
        //Do something with error
    }
}

//... The Captcha is valid you can continue with the rest of your code
//... Add code to filter access using $response . score
if ($response->success==true && $response->score <= 0.5) {
    //Do something to denied access
}
Comment

PREVIOUS NEXT
Code Example
Php :: can we create linked list in php 
Php :: guzzle Request with POST files 
Php :: eloquent where parentheses 
Php :: laravel upload base64 image 
Php :: explode with new line 
Php :: php match 
Php :: php postgresql 
Php :: php is_int 
Php :: replace all occurrence char in string php 
Php :: how to get a sum of a column in lravel 
Php :: error_log wordpress 
Php :: laravel use variable inside callback function 
Php :: php gethostname 
Php :: laravel local file storage 
Php :: check if file empty php 
Php :: hide add new link on cpt page 
Php :: array_column in php 
Php :: display image from mysqli database 
Php :: drop column table in migration if exist in laravel 
Php :: php find similitur in two array 
Php :: php remove non utf-8 characters 
Php :: upload multiple images in php 
Php :: macos how host laravel website on localhost and intranet wifi 
Php :: how to solve php mysqli_query function problem does not execute 
Php :: check if array is empty php 
Php :: password_verify php 
Php :: php check if checkbox isset 
Php :: contact form 7 checkbox2 
Php :: laravel enable mysql logging 
Php :: php custom autoload 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =