# Pass XML string from PHP to Flash

**URL:** <https://forum.kirupa.com/t/pass-xml-string-from-php-to-flash/247296>\
**Category:** flash\
**Created:** [December 20, 2007, 9:32pm UTC](https://forum.kirupa.com/t/pass-xml-string-from-php-to-flash/247296 "2007-12-20T21:32:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![matteblack](https://avatars.discourse-cdn.com/v4/letter/m/9d8465/32.png) [@matteblack](https://forum.kirupa.com/u/matteblack)\
**Post date:** [December 20, 2007, 9:32pm UTC](https://forum.kirupa.com/t/pass-xml-string-from-php-to-flash/247296/1 "2007-12-20T21:32:38Z")

</div>

Hi everyone, I’m hoping someone can help me out. I’ve been searching how to do this but haven’t got it to work yet.

All I want to do is have flash call my php page which is putting together an xml string as a variable. I want to take that xmlstring in flash and parse it into my array.

I know how to do everything except load that XML string and parse it. I know how to parse an xml file, but a string is new to me. Also, for some reason when I try to get the XML string from PHP it comes back undefined.

Here is my Flash Actionscript:  
// Call PHP and load XML string  
loadVariablesNum(“[http://domain/recentimages.php","](http://domain/recentimages.php%22,%22)”);

//My PHP file spits out the string as $recentxml, and it works fine. But when I try to trace that same string in Flash I get undefined.

//Here is the loop I’ve created to wait until the xml has been generated.

if (recentxml == undefined){

gotoAndPlay(“loop”);

} else if (recentxml != undefined){

```
    gotoAndStop("finished");

```

}

//And here is the parsing method.  
var myPhoto:XML = new XML();  
myPhoto.parseXML(recentxml);  
myPhoto.ignoreWhite = true;

Can anyone help? I would really appreciate any advice, I’ve been struggling with this for a while now and it’s probably something easy.

Thanks, Matt
