Files
html/api/wevia-chat-relay.php
2026-04-12 22:57:03 +02:00

21 lines
724 B
PHP

<?php
header("Content-Type: application/json");
$msg = $_GET["m"] ?? "";
if(!$msg) die(json_encode(["error"=>"no message"]));
$ch = curl_init("https://127.0.0.1/api/weval-ia");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => json_encode(["message"=>$msg,"mode"=>"fast"]),
CURLOPT_HTTPHEADER => ["Content-Type: application/json","Cookie: PHPSESSID=relay;weval_user=yacine"],
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_TIMEOUT => 25
]);
$r = curl_exec($ch);
$d = json_decode($r, true);
echo json_encode([
"provider" => $d["provider"] ?? "?",
"response_b64" => base64_encode($d["response"] ?? ""),
"len" => strlen($d["response"] ?? "")
]);