Parse feed.xml to feed.php on the fly
I'm trying to add a news ticker on a website.
The data headlines are based on a RSS feed.
The ticker needs to read a php file of the feed.xml RSS file data.
The RSS feed will change constantly, therefore the php file referenced in the ticker would work best if it updated automatically from the feed.xml file.
I know next to nothing about php, but I assume this is possible. The feed.xml simply becomes a variable within the feed.php file, populates the ticker, and off it goes.
The data in the feed.xml file is, for example
<?xml version="1.0" ?>
<title>The Website Name</title>
<description>The Website Description</description>
see also this thread http://www.webdeveloper.com/forum/sh...409#post776409
$rss = file_get_contents("http://domain.com/rss/feed.xml");
$regex = '#<item>.*<title>(.*)</title>.*<link>(.*)</link>.*</item>#Us';
preg_match_all($regex, $rss, $matches, PREG_SET_ORDER);
foreach($matches as $article)
printf("<li><a href='%s'>%s</a></p>\n", $article, $article);
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)