Gallery php instead of xml

The gallery below uses XML, but I want to modify it to use PHP. I have included a PHP script that I want to incorporate, which just returns image URL’s. How would I modify this to work with PHP, and specifically the script I have included. Thanks in advance.


myPhoto = new XML();
myPhoto.ignoreWhite = true;
myPhoto.onLoad = function(success) {
    //portfolioTag = this.firstChild;
    numimages = this.firstChild.childNodes.length;
    spacing = 70;
    for (i=0; i<numimages; i++) {
        this.picHolder = this.firstChild.childNodes*;
        this.thumbHolder = thumbnails.createEmptyMovieClip("thumbnail"+i, i);
        this.thumbHolder._x = i*spacing;
        this.thumbLoader = this.thumbHolder.createEmptyMovieClip("thumbnail_image", 0);
        this.thumbLoader.loadMovie(this.picHolder.attributes.thmb);
        this.thumbHolder.title = this.picHolder.attributes.title;
        this.thumbHolder.main = this.picHolder.attributes.main;
        this.thumbHolder.onRelease = function() {
            loader.loadMovie(this.main);
            title_txt.text = this.title;
        };
    }
};
myPhoto.load("xmlphoto.xml");


 <?php 

$userids = array('12345678', '76543210', '98765432'); // all userids go in here 
for($i=0; $i<sizeof($userids); $i++){ 
  displayImage($userids[$i], $i); 
} 

function displayImage($id, $img_count){ 
  $u= "http://profile.myspace.com/index.cfm?fuseaction=user.viewprofile&friendid=$id"; 

  $t = join("",file("$u")); 

  $r = '/ctl00_Main_ctl00_UserBasicInformation1_hlDefaultImage" .*?"><img src="(.*?)"/'; 

  $t = ereg_replace("
", "", $t); 

  preg_match_all($r, $t, $m); 

  $img=$m[1][0]; 

  echo ("&myImage".$img_count."=".$img);   
}   


?>