= 200 && $httpCode < 300) { file_put_contents($cacheFile, $response); } else { header('HTTP/1.1 500 Internal Server Error'); header('Content-Type: application/json; charset=utf-8'); echo json_encode([ 'error' => 'Konnte Daten nicht von der Cloud laden.', 'http_status' => $httpCode, 'curl_error' => $curlError ? $curlError : 'Kein spezifischer cURL-Fehler. Cloud antwortete nicht mit HTTP 200.' ]); exit; } } header('Content-Type: application/json; charset=utf-8'); echo $response;