RSS des 50 dernières décisions CNIL hors JO (uniquement) header('content-type: application/rss+xml; charset=utf-8'); // Contournement protection anti-robots basique de Cloudflare $opts = [ 'http' => [ 'header' => "User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0\r\n" . "Upgrade-Insecure-Requests: 1" . "Cookie: foo=bar", ] ]; $context = stream_context_create($opts); $response = file_get_contents('https://www.legifrance.gouv.fr/search?typeRecherche=date&fonds=CNIL&searchField=ALL&query=&searchProximity=&searchType=ALL&typePagination=DEFAUT&timeInterval=&sortValue=DATE_DECISION_DESC&pageSize=50&page=1', false, $context); $response = mb_convert_encoding($response, 'HTML-ENTITIES', "UTF-8"); $dom = new DOMDocument(); libxml_use_internal_errors(true); $dom->loadHTML($response); $xpath = new DOMXpath($dom); $elements = $xpath->query('//article[@class="result-item"]//h2/a'); echo ' CNIL - Légifrance - hors JO https://www.legifrance.gouv.fr Les délibérations CNIL hors JO'.PHP_EOL.PHP_EOL; foreach ($elements as $item) { echo ' <![CDATA['.str_replace(array("\r\n", "\n", "\r"), "", $item->nodeValue).']]> '.explode("?", $item->getAttribute("href"))[0].' nodeValue).']]> '.$item->id.' '.PHP_EOL; } echo ' '; ?>