22 lines
815 B
PHP
22 lines
815 B
PHP
<?php
|
|
header("Access-Control-Allow-Origin: *");
|
|
header("Access-Control-Allow-Methods: POST, OPTIONS");
|
|
header("Access-Control-Allow-Headers: Content-Type");
|
|
header("Content-Type: application/json");
|
|
|
|
if ($_SERVER["REQUEST_METHOD"] === "OPTIONS") {
|
|
http_response_code(200);
|
|
exit;
|
|
}
|
|
|
|
$input = file_get_contents("php://input");
|
|
$ch = curl_init("http://204.168.152.13:5821/weval-chatbot-api.php");
|
|
curl_setopt($ch, CURLOPT_POST, true);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $input);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Content-Type: application/json"]);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 30);
|
|
$response = curl_exec($ch);
|
|
curl_close($ch);
|
|
echo $response ?: json_encode(["response" => "Service temporairement indisponible. Contactez info@weval-consulting.com"]);
|