Blog Home Dudermang

Sports rss


Posted on 2016-09-28 00:00:19

Have you ever seen or heard of sites providing an RSS feed? Basically most big websites have an xml or json text string that they update every time there is an update to their site. They provide this string to the public and search engines so you can get the benefit of their website in your own custom application or interface.

We have written some code that will allow you to interface with stltodays rss feed and extract data. We use php and html to accomplih this. See below

<?php $html = ""; $url = "*&k=NOT+%23slsa*+*:*&d1=&d2=&s=start_time&sd=desc&f=rss&&l=50&t=article,link,collection,html"; $xml = simplexml_load_file($url); $count = '10'; for($i = 0; $i < $count; $i++) { $item = $xml->channel->item[$i]; $name = $xml->channel->item[$i]->title; $bid = $xml->channel->item[$i]->description; $change = $xml->channel->item[$i]->PubDate; $url = $xml->channel->item[$i]->enclosure[url]; $de = $desc; $img = $desc; $de=substr($de, 0, strrpos($de, '<br clear=')); $html.= " <img src='$url' alt='no image found' /> <li style='font-size:7px;'> <strong><h2>$name <span style=\"padding-left:20px;\">$bid </span> <span style=\"padding-left:20px;\">$change</span></h2></strong> </li>"; } echo $html; ?>


php, xml, parse, html