Files
php-science/rss-science.php
2017-10-10 14:11:20 +01:00

11 lines
348 B
PHP

<?php
header('Content-Type: text/xml');
$sUrl = 'http://www.sciencemag.org/rss/current.xml';
$oXml = new SimpleXMLElement(file_get_contents($sUrl));
for ($i = count($oXml->item) - 1; $i >= 0; --$i) {
$oItemXml = $oXml->item[$i];
if (strpos($oItemXml->title, 'Chemistry:') === false) {
unset($oXml->item[$i]);
}
}
echo $oXml->asXML();