Results 1 to 2 of 2

Thread: Parse feed.xml to feed.php on the fly

  1. #1
    Join Date
    Jul 2007

    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" ?>
    <rss version="2.0">
    <title>The Website Name</title>
    <description>The Website Description</description>

    <title>Headline article</title>
    <guid isPermaLink="true">http://www.thewebsiteurl.com/specificarticle.html</guid>


    I want to grab the </ item> data, so that if you click on the headline <title> in the ticker it will open the <link> url in a new window. The php file needs to grab those two elements, and from there I can work on the javascript to make that happen. (ever the optimist)

    see also this thread http://www.webdeveloper.com/forum/sh...409#post776409


  2. #2
    Join Date
    Aug 2004
    One way:
    PHP Code:
    $regex '#<item>.*<title>(.*)</title>.*<link>(.*)</link>.*</item>#Us';
    $matches as $article)
    printf("<li><a href='%s'>%s</a></p>\n"$article[2], $article[1]);
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center