'Matrice' ]; // Debug URL $base_url = 'https://93.43.5.102/limsapi/api/odata/'; $query = http_build_query($options); $queryReadable = urldecode($query); $full_url = $base_url . $endpoint . ($queryReadable ? '?' . $queryReadable : ''); file_put_contents( __DIR__ . '/last_url_check_matrice.txt', $full_url . PHP_EOL, FILE_APPEND ); // Chiamata API $data = $api->get($endpoint, $options); // Recupero Matrice dalla response $matrice = $data['Matrice'] ?? null; $actualMatriceId = null; if (is_array($matrice)) { // Provo i nomi più probabili $actualMatriceId = $matrice['IdMatrice'] ?? $matrice['idMatrice'] ?? $matrice['Id'] ?? $matrice['ID'] ?? null; } $matrice_ok = ((int)$actualMatriceId === (int)$expectedMatriceId); $output = [ 'success' => true, 'idCampione' => $idCampione, 'expectedMatriceId' => $expectedMatriceId, 'actualMatriceId' => $actualMatriceId, 'matrice_ok' => $matrice_ok, 'request_url' => $full_url, 'matrice' => $matrice, 'raw_response' => $data ]; // Salva JSON completo file_put_contents( __DIR__ . '/check_matrice_campione_749027_response.json', json_encode($output, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE) ); echo json_encode($output, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); } catch (Exception $e) { file_put_contents( __DIR__ . '/error_log_check_matrice.txt', date('Y-m-d H:i:s') . ' - ' . $e->getMessage() . PHP_EOL, FILE_APPEND ); http_response_code(500); echo json_encode([ 'success' => false, 'error' => $e->getMessage() ], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE); }