Files
paraandClaude Opus 5.5 46b7c5af2c Drop news/agenda feeds: silly.be moved to WordPress with official feeds
The commune rebuilt silly.be on WordPress; the Plone @results API these
scripts relied on is gone (every request now 301s to the new page), so
actualites.php and agenda.php were serving empty channels. The new site
publishes its own feeds (/actualites/feed/, /agenda/feed/), so rather than
rewrite against the WordPress API, subscribe to those directly.

Removes actualites.php, agenda.php, the Python variant and its cron/nginx
deploy files, and trims common.php to what facebook.php still uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 22:09:23 +01:00

32 lines
968 B
PHP

<?php
const USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36';
const CACHE_DIR = __DIR__ . '/cache';
const CACHE_TTL_SECONDS = 900; // 15 minutes
function http_get(string $url, array $extraHeaders = []): string
{
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_USERAGENT => USER_AGENT,
CURLOPT_HTTPHEADER => $extraHeaders,
CURLOPT_TIMEOUT => 20,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_MAXREDIRS => 3,
]);
$body = curl_exec($ch);
$errno = curl_errno($ch);
$error = curl_error($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($errno !== 0) {
throw new RuntimeException("curl error fetching $url: $error");
}
if ($status >= 400) {
throw new RuntimeException("HTTP $status fetching $url");
}
return $body;
}