'Errore nell\'autenticazione', 'http_code' => $http_code, 'response' => $response]); exit; } $token = trim($response); // Rimuove spazi o newline dal token // Usa il token per richiedere la lista dei clienti $clienti_url = 'https://93.43.5.102/limsapi/api/odata/Cliente'; $ch = curl_init($clienti_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPGET, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token, 'Accept: application/json', 'Host: iftm.it' ]); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); // Disabilita verifica SSL curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // Disabilita verifica host $response = curl_exec($ch); $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); $curl_error = curl_error($ch); curl_close($ch); if ($http_code != 200) { echo json_encode(['error' => 'Errore nella richiesta dei clienti', 'http_code' => $http_code, 'curl_error' => $curl_error, 'response' => $response]); } else { echo $response; // Restituisce la lista completa dei clienti in JSON } ?>