Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php header("Content-Type: application/rss+xml; charset=UTF-8"); setlocale(LC_TIME,'Italian_Italy.UTF-8','Italian_Italy.1250','it'); ?><?php echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" ?>
- <rss version="2.0">
- <channel>
- <title>Turbolab Italia</title>
- <link>https://turbolab.it</link>
- <description>Conversione RSS per Amazon Alexa</description>
- <language>it-IT</language>
- <copyright>Copyright 2019, TurboLab.it</copyright>
- <?php
- $xmldom = new DOMDocument();
- $xmldom->load("https://turbolab.it/feed");
- $items = $xmldom->getElementsByTagName("item");
- for($i=0; $i<5 && $i<$items->length-1; $i++) {
- $title = $items->item($i)->getElementsByTagName("title")->item(0)->childNodes->item(0)->nodeValue;
- $title = preg_replace('/[^A-Za-z0-9 \’\'\,\.àèìòùé]/', '', $title);
- $link = $items->item($i)->getElementsByTagName("link")->item(0)->childNodes->item(0)->nodeValue;
- $description = $items->item($i)->getElementsByTagName("description")->item(0)->textContent;
- $description = preg_match('/<p>(.*?)<\/p>/',$description,$paragrafi);
- $description = $paragrafi[1];
- $description = preg_replace('/[^A-Za-z0-9 \’\'\,\.àèìòùé]/', '', $description);
- $pubDate = $items->item($i)->getElementsByTagName("pubDate")->item(0)->childNodes->item(0)->nodeValue;
- $guid = $items->item($i)->getElementsByTagName("guid")->item(0)->childNodes->item(0)->nodeValue;
- ?>
- <item>
- <title><?php echo $title; ?></title>
- <link><?php echo $link; ?></link>
- <description><?php echo $description; ?></description>
- <pubDate><?php echo $pubDate; ?></pubDate>
- <guid><?php echo $guid; ?></guid>
- </item>
- <?php } ?>
- </channel>
- </rss>
Add Comment
Please, Sign In to add comment