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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T14:40:56+00:00 2026-06-06T14:40:56+00:00

I am trying to dynamically create an XML file using php like this: header

  • 0

I am trying to dynamically create an XML file using php like this:

  header ("content-type: text/xml");

  // create doctype
  $dom = new DOMDocument("1.0");

  // create root element
  $root = $dom->createElement("tracklist");
  $dom->appendChild($root);
  $dom->formatOutput=true;

  // create child element
  foreach ($commonPlaylist as $value) {

     $trackArray = getTrackForID($value['ID']);

     $item = $dom->createElement("track");
     $root->appendChild($item);

     foreach ( $trackArray as $key => $value) {
      $attr = $dom->createAttribute($key);
      $item->appendChild($attr);

          $attrValue = $dom->createTextNode($value);
      $attr->appendChild($attrValue);
     }

  }

 echo $dom->saveXML();

The output of the file is normal working xml

<?xml version="1.0"?>
   <tracklist>
        <track ID="4" title="Track01" artist="Artist01" url="" length="" coverURL=""/>
        <track ID="1" title="Track02" artist="Artist02" url="" length="" coverURL=""/>
        <track ID="8" title="Track03" artist="Artist03" url="" length="" coverURL=""/>
   </tracklist>

However if I want to get this data into as3 with the following code:

var myLoader:URLLoader = new URLLoader();
myLoader.load(new URLRequest("getPlaylist.php"));
myLoader.addEventListener(Event.COMPLETE, processXML);

function processXML(e:Event):void
{
    var myXml:XML= new XML(e.target.data);
    trace(myXml);  // The variable is being traced.

}

I don’t get any output at all. If I read the file as a String I get the whole PHP code. What am I doing wrong?

Thank you in advance for any help.

Regards,
Matteo

  • 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-06-06T14:40:57+00:00Added an answer on June 6, 2026 at 2:40 pm

    If I read the file as a String I get the whole PHP code

    It sounds like it’s not being executed server-side. Are you hosting it on a server with PHP installed?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a dynamically generated XML file from Java. This is
I'm trying to dynamically create a form using JQuery. In order to do this,
im trying to create an xml data into JSP using a resource file: MyData.properties
I'm trying to dynamically create an object of a certain type in a LINQ-to-XML
I'm trying to dynamically create buttons at runtime with PyQT4.7 However, this being my
I am trying to create dynamic excel sheet, with the help of php using
I am trying to dynamically create a XML for a webservice but when I
I am trying to create a WebView dynamically using the following code: mWebView =
I am trying to use jPanel for collapsible panel, dynamically from an xml content,
I'm trying to create a TableLayout dynamically which has all its rows stretched like

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.