[ 'timeout' => 5, 'header' => "Referer: https://soutenir.index.ngo\r\n", ], ]); $response = @file_get_contents($url, false, $context); if ($response !== false) { $data = json_decode($response, true); if ($data && !isset($data['error'])) { @file_put_contents($cacheFile, $response, LOCK_EX); return $data; } } // Fallback: serve stale cache rather than nothing if (file_exists($cacheFile)) { return json_decode(file_get_contents($cacheFile), true) ?: []; } return []; }