Validate ReCaptcha token using PHP

Tiempo de lectura: < 1 minuto

In this example, we pass the obtained reCaptcha code through the JSON body and validate it.

Replace SECRET_CODE with the secret code obtained when creating the captcha.

To send the remote IP, you can use HTTP_CLIENT_IP or HTTP_X_REAL_IP if you are using a reverse proxy like NPM.

Finally, validate the captcha token and allow the process to continue.

Leave a Comment