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);
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)