Display XML from a called php script

The php script is creating a list of files in my specified directory.
Now I am trying to create actionscript to call the php script and display the xml results.  I have found scripts for value separated scripts... but none for xml.   Anybody done this?  Code examples appreciated.

Yes this a script I am running local FYI (I have wamp server)

Thanks much
<?php // select the directory to list

$path = "file:///C:/evolve/";



// Initalise some variables

$output_string = '';

$file_number = 0;



// Get the directory handle

$dir = dir( $path ); 

// Read all files / dirs in the directory

print "<?xml version=\"1.0\"?>\n";

print "<myMenu>\n";

while ( false !== ( $file_name = $dir->read() ) ) { 



        // Exclude this dir and parent dir

        if( $file_name[0] != '.' ){

                // Add file to the output string

                //$output_string .= "&file_" . ++$file_number . "=" . urlencode( $file_name );

				print "<file>".$file_name."</file>\n";

				//print $file_name."<br>";

        }



} 

print "</myMenu>";

$dir->close();
?>

Open in new window

bowerdesignAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CyanBlueCommented:
What version of ActionScript do you use???
What is the XML output from that PHP script???

CyanBlue
0
bowerdesignAuthor Commented:
Thanks for looking!

AS2

<myMenu>
<file>client1.project_2.site_001.xml</file>
<file>client1.project_2.site_002.xml</file>
<file>client1.project_2.site_003.xml</file>
<file>Copy of client1.project_2.site_003.xml</file>
</myMenu>
0
CyanBlueCommented:
Try something like this...

CyanBlue
var _xml = new XML();
_xml.onLoad = function(loaded)
{
	if (loaded)
	{
		trace(this);
	}
}
_xml.load("pathTo.php");

Open in new window

0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

bowerdesignAuthor Commented:
Hey Cyan
I changed to this:
var _xml = new XML();
xmlData.ignoreWhite = true;
_xml.onLoad = function(loaded)
{
      if (loaded)
      {
            trace(this);
            testFiles.text = (this);
      }
}
_xml.load("xmlDirectory.php");
----------------------------------------------------------------------------

AND... I got this for swf output:

<?xml version="1.0"?>



client1.project_2.site_001.xml
client1.project_2.site_002.xml
client1.project_2.site_003.xml
Copy of client1.project_2.site_003.xml


----------------------------------------------------------------

Now I just need to strip the files out from the xml ?nodes?.
Y/N
0
CyanBlueCommented:
If you do this, all the content of the file nodes will be pushed into the file_arr which you can use later on...

CyanBlue
var file_arr:Array = new Array();

var _xml = new XML();
_xml.ignoreWhite = true;
_xml.onLoad = function(loaded)
{
	if (loaded)
	{
		parseXML(this);
	}
};
_xml.load("LoadXMLAS2.xml");

function parseXML(xml:XML)
{
	var node = xml.firstChild.childNodes;
	for (var a = 0; a < node.length; a++)
	{
		file_arr.push(node[a].firstChild);
	}
	
	trace("file_arr = " + file_arr);
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bowerdesignAuthor Commented:
Awesome, that gets me on the road.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.