-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
captcha-request.php
36 lines (23 loc) · 875 Bytes
/
captcha-request.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
// Include the captcha classes.
require_once __DIR__ . '/../vendor/autoload.php';
use IconCaptcha\IconCaptcha;
try {
// Start a session.
// * Only required when using any 'session' driver in the configuration. See the documentation for more information.
session_start();
// Load the IconCaptcha options.
$options = require 'captcha-config.php';
// Create an instance of IconCaptcha.
$captcha = new IconCaptcha($options);
// Handle the CORS preflight request.
// * If you have disabled CORS in the configuration, you may remove this line.
$captcha->handleCors();
// Process the request.
$captcha->request()->process();
// Request was not supported/recognized.
http_response_code(400);
} catch (Throwable $exception) {
http_response_code(500);
// Add your custom error logging handling here.
}