Siteβ―Builder
Editing:
rss-proxxxxy.php
writable 0666
<?php /************************************************************************* * RSS-PROXY β /social/rss-proxy.php?feed=<rss_url> * * βΊ Returns: {"items":[{"title","link","date"}β¦], "url":"β¦"} (JSON) * βΊ Max 5 items, 15 s script timeout, 3 s connect + 10 s download * βΊ ONLY fetches the exact feed URL you pass *************************************************************************/ declare(strict_types=1); header('Content-Type: application/json; charset=utf-8'); set_time_limit(15); // 1οΈβ£ validate incoming feed URL $feed = $_GET['feed'] ?? ''; if (!filter_var($feed, FILTER_VALIDATE_URL)) { http_response_code(400); echo json_encode(['error' => 'Invalid or missing feed URL']); exit; } // 2οΈβ£ fetch via cURL with strict timeouts $ch = curl_init($feed); curl_setopt_array($ch, [ CURLOPT_RETURNTRANSFER => true, CURLOPT_FAILONERROR => true, CURLOPT_FOLLOWLOCATION => true, CURLOPT_CONNECTTIMEOUT => 3, CURLOPT_TIMEOUT => 10, CURLOPT_USERAGENT => 'RSS-Proxy/1.0', ]); $xmlData = curl_exec($ch); curl_close($ch); // 3οΈβ£ parse up to 5 <item> elements $items = []; if ($xmlData !== false) { $xml = @simplexml_load_string($xmlData, 'SimpleXMLElement', LIBXML_NOCDATA); if ($xml && isset($xml->channel->item)) { foreach ($xml->channel->item as $it) { $items[] = [ 'title' => (string)$it->title, 'link' => (string)$it->link, 'date' => (string)$it->pubDate, ]; if (count($items) >= 5) { break; } } } } // 4οΈβ£ output JSON echo json_encode( ['items' => $items, 'url' => $feed], JSON_UNESCAPED_SLASHES );
Save changes
Create folder
writable 0777
Create
Cancel