A
A
Artyom2015-10-28 15:02:08
HTML
Artyom, 2015-10-28 15:02:08

How to connect reCAPTCHA correctly?

Registered captcha. How to implement the correct integration on the client and server side?
Simply inserted into the form div. Will it work this way submit? How to link submitand captcha?

<div class="g-recaptcha" data-sitekey=""></div> <button type="submit" class="btn btn-xl" value="submit">ОТПРАВИТЬ</button>

Here we are talking about a POST request:
nYWA92o.png
Through what to send it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
HAbRAhabp, 2015-10-28
@HAbRAhabp

recaptcha accepts get requests

$url = 'https://www.google.com/recaptcha/api/siteverify?secret=YOU_SECRET_KEY&response='.(array_key_exists('g-recaptcha-response', $_POST) ? $_POST["g-recaptcha-response"] : '').'&remoteip='.$_SERVER['REMOTE_ADDR'];
$resp = json_decode(file_get_contents($url), true);
                    
if ($resp['success'] == true) {
//все хорошо 
}
else {
// капча не решена
}

you need the captcha to be in the form itself, where you have all the inputs

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question