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

  • SEARCH
  • Home
  • 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 7062231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:34:08+00:00 2026-05-28T04:34:08+00:00

long time listener first time caller… I have this function (I don;t recall where

  • 0

long time listener first time caller…

I have this function (I don;t recall where its from sorry, I’ve had it forever)

It simply parses an XML feed and creates a list of upcoming gigs – it was working fine but changing to a new server with latest PHP and it isn’t working.

    function parseRSS($url) { 

    $feedeed = implode('', file($url));
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $feedeed, $valueals, $index);
    xml_parser_free($parser);

    foreach($valueals as $keyey => $valueal){
        if($valueal['type'] != 'cdata') {
            $item[$keyey] = $valueal;
        }
    }
    $i = 0;
    foreach($item as $key => $value){
        if($value['type'] == 'open') {
            $i++;
            $itemame[$i] = $value['tag']; 
        } elseif($value['type'] == 'close') {

            $feed = $values[$i];
            $item = $itemame[$i];
            $i--;

            if(count($values[$i])>1){
                $values[$i][$item][] = $feed;
            } else {
                $values[$i][$item] = $feed;
            }
        } else {
            $values[$i][$value['tag']] = $value['value'];  
        }
    }
    return $values[0];
} 

$xml = parseRSS("http://acousti.co/feeds/artist/AboveThem");

$count = 0;

foreach($xml['RSS']['CHANNEL']['ITEM'] as $item) {
        $pubDate = $item['PUBDATE'];
        $pubDateFormatted = date('D j M Y', strtotime($pubDate));

        echo("<a href=\"{$item['LINK']}\" target=\"_blank\" class=\"indexBoxNews\">{$item['DESCRIPTION']}{$link}</a>
            <p class=\"rss-date\">$pubDateFormatted</p>");

        if (++$count == 5) break;
}

Does anyone know why it may have stopped working – the code was written pre-PHP5 that’s for sure so maybe it’s a compatibility issue?

Any help very much appreciated 🙂
Rob

  • 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-28T04:34:09+00:00Added an answer on May 28, 2026 at 4:34 am

    Since you’re now on PHP 5, you may want to just rewrite the code using simplexml. PHP4, without adding additional libraries, didn’t have a good easy way of dealing with XML, but now with PHP 5, your code should be a fraction of what you used for PHP 4.

    Try this:

    $xml = simplexml_load_file('http://acousti.co/feeds/artist/AboveThem');
    
    foreach ($xml->channel->item as $item)
    {
        $pubDateFormatted = date('D j M Y', strtotime((string) $item->pubDate));
        echo '<a href="' . (string) $item->link . '" target="_blank" class="indexBoxNews">' . (string) $item->description . '</a>
                <p class="rss-date">' . $pubDateFormatted . '</p>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

long time listener, first time caller... I am creating a splash screen derived from
long time listener, first time caller. I have a matrix of icons that can
Long time listener, first time caller. I'm a full time SE during the day
Long time listener, first time caller here. Ok, I apologize for the length of
I’m a long time listener, but first time caller here… Hoping you can help
As they say on the radio - long time listener first time caller.... Here's
long-time listener, first-time caller! I’m trying to connect to MySQL using the ADO.NET Entity
Long time listener - first time caller. I am hoping to get some advice.
Long time listener, first time caller… I've got two questions in a form, the
long-time listener, first-time caller. I am relatively new to programming and was looking back

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.