diff --git a/functions.php b/functions.php index 341c084..8491809 100644 --- a/functions.php +++ b/functions.php @@ -1,30 +1,5 @@ 'success', 'message' => 'OK']); } diff --git a/webhook.php b/webhook.php index f0da669..cd5027d 100644 --- a/webhook.php +++ b/webhook.php @@ -2,7 +2,16 @@ include 'config.php'; include 'functions.php'; -cors(); +// CORS +header("Access-Control-Allow-Origin: *"); +header('Access-Control-Max-Age: 86400'); // cache for 1 day +if (strtolower($_SERVER['REQUEST_METHOD']) == 'options') { + http_response_code(204); + header("Access-Control-Allow-Headers: origin, content-type, accept"); + header("Access-Control-Allow-Methods: GET, POST, OPTIONS"); + header("Access-Control-Allow-Private-Network: true"); + exit(0); +} // Read the raw POST data $data = json_decode(file_get_contents('php://input'), true)