Answer the question
In order to leave comments, you need to log in
How to reduce the load on the site from PHP code when parsing RSS news feeds?
I have PHP code installed on my site
header("Content-Type: text/html; charset=utf-8");
$url = "https://vkrss.com/lJOxFYPHLRiItCUE/[xfvalue_vk]?filter=all"; // Адрес до RSS-ленты
$rss = simplexml_load_file($url);
foreach ($rss->channel->item as $items) {
echo <<<HTML
<h5><font color="white"><code>{$items->pubDate}</code></font></h5>
<p><font color="white">{$items->description}</font></p>
<a href="{$items->link}"><button class="label label-success" style="text-decoration: none;">
<font color="white"> Подробнее</font>
</center>
</button>
</a>
<hr>
HTML;
}
Answer the question
In order to leave comments, you need to log in
1. Fence news - once every N-minutes. It is possible by request, it is possible through cron.
2. After we took it, we cache it in a file ("raw" cache).
3. Then - we process it as it is necessary for output on the site and also save it to a file ("prepared" cache).
4. Output - always from the prepared cache file (to reduce the load on the hosting).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question