39 lines
979 B
PHP
39 lines
979 B
PHP
<?php
|
|
require_once dirname(__DIR__, 2) . '/vendor/autoload.php';
|
|
require_once __DIR__ . '/class/VisualLimsApiClient.class.php';
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
// Disable PHP error display
|
|
ini_set('display_errors', '0');
|
|
error_reporting(E_ALL);
|
|
|
|
try {
|
|
$api = VisualLimsApiClient::getInstance();
|
|
|
|
// Parametri OData
|
|
$params = [
|
|
'$select' => 'IdCliente,Nominativo,CodiceNazioneFatturazione',
|
|
'$orderby' => 'Nominativo asc'
|
|
];
|
|
|
|
// Costruisce query string con encoding corretto
|
|
$queryString = http_build_query($params);
|
|
|
|
// Componi endpoint finale
|
|
$endpoint = "Cliente?$queryString";
|
|
|
|
// Richiama API
|
|
$data = $api->get($endpoint);
|
|
|
|
// Salva risposta per debug
|
|
file_put_contents(__DIR__ . '/clienti_response.json', json_encode($data, JSON_PRETTY_PRINT));
|
|
|
|
echo json_encode($data);
|
|
} catch (Exception $e) {
|
|
http_response_code(500);
|
|
echo json_encode([
|
|
'error' => $e->getMessage()
|
|
]);
|
|
}
|