Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:00:23+00:00 2026-05-29T08:00:23+00:00

I have an rss feed that I am reading into. I need to retrieve

  • 0

I have an rss feed that I am reading into. I need to retrieve certain data from the field in this feed.

This is the example feed data :

<content:encoded><![CDATA[
    <b>When:</b><br />
    Weekly Event - Every Thursday: 1:30 PM to 3:30 PM (CT)<br /><br />
      <b>Where:</b><br />
      100 West Street<BR>2nd floor<BR>Gainesville<BR>
      <br>.....

How do I pull out the data for When: and Where: respectively? I attempted to use regex but I am unsure if I am not accessing the data correctly or if my regex expression is wrong. I’m not set on using regex.

This is my code:

    foreach ($x->channel->item as $event) {
    $eventCounter++;
    $rowColor = ($eventCounter % 2 == 0) ? '#FFFFFF' : '#F1F1F1';
    $content = $event->children('http://purl.org/rss/1.0/modules/content/');
    $contents = $content->encoded;
    echo '<tr style="background-color:' . $rowColor . '">';
    echo '<td>';
    //echo "<a id=buttonRed href='$event->link' title='$event->title' target='_blank'>" . $event->title . "</a>";
    echo "" . $event->title . "";
    echo '</td>';
    echo '<td>';
    $re = '%when\:\s*</b>\s*(.|\s)<br \/><br \/>$/i';
    if (preg_match($re, $contents, $matches)) {
        $date = $matches;
    }
    echo $date;
    echo '</td>';
    echo '<td>';
    $re = '/^When\:<\/b>()$/';
    if (preg_match($re, $contents, $matches)) {
        $location = $matches;
    }
    echo $location;
    echo '</td>';
    echo '<td>';
    echo "<a id=buttonRed href='$event->link' title='$event->title' target='_blank'>Click Here To Register</a>";
    echo '</td>';
    echo '</tr>';
}

The two $res are just my attempt to get the data out using different regex expressions. Let me know where I am going wrong. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:00:25+00:00Added an answer on May 29, 2026 at 8:00 am

    The following should sort of get you there. (I wrote this from the top of my head and it does not exactly following your XML syntax. But you get the idea.)

    <?php
    $str = "<root><b>When:</b> whenwhen <b>Where:</b> wherewhere</root>";
    
    $doc = new DOMDocument();
    $doc->loadXML($str);
    
    $when = $where = "";
    $target = null;
    
    foreach ($doc->documentElement->childNodes as $node) {
        if ($node->tagName == "b") {
            if (++$i == 1) {
                $target = &$when;
            } else {
                $target = &$where;
            }
        }
    
        if ($target !== null && $node->nodeType === XML_TEXT_NODE) {
            $target .= $node->nodeValue;
        }
    }
    
    var_dump($when, $where);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an RSS feed from Zendesk (http://mysupport.zendesk.com/forums/some-path/posts.rss) that I need to render as
I have a PHP script that generates an RSS feed using some external data
i have this rss feed to parse that contains several tags. i am able
I have a partial template that calls feed = Feedzirra::Feed.fetch_and_parse(http://my.rss.feed) @entries = feed.entries This
I have a website that I need to create an RSS feed for. Is
I have the following code that converts my twitter account rss feed into a
I'm working on an app that is reading it's data from a customized RSS
I have RSS feed that I want to modify on fly, all I need
I have a dynamically generated rss feed that is about 150M in size (don't
I have a RSS feed i need to display in a table (its clothes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.