45 lines
1.5 KiB
PHP
45 lines
1.5 KiB
PHP
<?php
|
|
header('Content-Type: application/json');
|
|
|
|
// Simule un POST avec master add intent
|
|
$payload = json_encode(["message" => "master add intent opus4_internal_test :: t_a|t_b :: echo internal"]);
|
|
|
|
$ch = curl_init('http://127.0.0.1/api/weval-ia');
|
|
curl_setopt_array($ch, [
|
|
CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => $payload,
|
|
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_TIMEOUT => 20,
|
|
CURLOPT_HEADER => true,
|
|
]);
|
|
$response = curl_exec($ch);
|
|
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
|
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
|
|
curl_close($ch);
|
|
|
|
$headers = substr($response, 0, $header_size);
|
|
$body = substr($response, $header_size);
|
|
|
|
// Test parallèle : appelle directement le master-api pour comparer
|
|
$ch2 = curl_init('http://127.0.0.1/api/wevia-master-api.php');
|
|
curl_setopt_array($ch2, [
|
|
CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => $payload,
|
|
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_TIMEOUT => 20,
|
|
]);
|
|
$resp2 = curl_exec($ch2);
|
|
curl_close($ch2);
|
|
|
|
echo json_encode([
|
|
'weval_ia_http' => $http_code,
|
|
'weval_ia_headers' => $headers,
|
|
'weval_ia_body' => substr($body, 0, 600),
|
|
'weval_ia_json_decoded' => @json_decode($body, true),
|
|
'--- COMPARE ---',
|
|
'master_api_body' => substr($resp2, 0, 600),
|
|
'master_api_json' => @json_decode($resp2, true),
|
|
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
|