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 … Read more

Redirect PHP errors to Docker console or Linux console

Redirect PHP errors to Docker console or Linux console

Tiempo de lectura: < 1 minuto Today we’re going to learn how to create a handler to redirect PHP errors to the Linux or Docker console. The first thing we need to do is to create a handler, we can call it exception_handler.php. And let’s add the following: <?php function handleException($exception) { // Get information about the exception $message = ‘ERR: … Read more

Notify by email of 500 errors or exceptions with PHP

Notify by email of 500 errors or exceptions with PHP

Tiempo de lectura: 2 minutos When developing web applications in PHP, it is essential to handle errors effectively to ensure a smooth user experience and to promptly notify system administrators of any issues. In this tutorial, we will learn how to implement a basic exception handling system that will automatically send an email to the administrator when a 500 error … Read more