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 6945741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:28:30+00:00 2026-05-27T13:28:30+00:00

I created an RSS feed page with PHP and tried to run it through

  • 0

I created an RSS feed page with PHP and tried to run it through through a JavaScript RSS reader code (http://www.zazar.net/developers/jquery/zrssfeed/ )

It does not recognize the PHP file as having XML code. Though I copied the rendered code generated from PHP and added it in an XML file and it worked.

Is there a way to change this PHP file extension into an XML? Or make the PHP file visible to the above JavaScript code?

I tried using the .htaccess to change the file type (as there are tutorials all over covering that) but it did not work.

Can you recommend anything?

This is my code:

<?php
header ("Content-Type:text/xml");  
$xml = new SimpleXMLElement('<xml/>');

for ($i = 1; $i <= 8; ++$i) {
    $track = $xml->addChild('track');
    $track->addChild('path', "song$i.mp3");
    $track->addChild('title', "Track $i - Track Title");
}

print($xml->asXML());

?>
  • 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-27T13:28:31+00:00Added an answer on May 27, 2026 at 1:28 pm

    Some environments do not manage files based on mime-types but just rely on the extension of the filename. I would change two things:

    • You can try to force the filename to have .xml / .rss extension.
    • Do not use ‘xml’ as a node name. Change it to ‘playlist’ or some other thing.

    So, the code could be something like this:

    <?php
    header ("Content-Type: text/xml");
    $filename = 'playlist.rss';
    header ("Content-Disposition: attachment; filename=$filename");
    $xml = new SimpleXMLElement('<playlist/>');
    ... // The rest of the code keeps as the original
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i've created an rss feed in php using the below code. i've double checked
I created podcast rss feed - http://topdj-test.com.ua/podcast/audio-files/12/3/ And I set up <image> and <itunes:image>
I am currently trying to display a RSS feed in a PHP page, but
How do I create an RSS feed in ASP.NET? Is there anything built in
I'm trying to create a RSS 2.0 feed in ASP.NET C# with products to
I created a few mediawiki custom tags, using the guide found here http://www.mediawiki.org/wiki/Manual:Tag_extensions I
I have a website which includes this RSS JavaScript. When I click feed, it
I have created an RSS feed, that contains non-ASCII characters URLs (IRI). That's why
I am trying to generate an RSS feed on my site using the code
I created an RSS feed with Java Rome lib. The project is near the

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.