Php in flash

Hi, I have set up a PHP script that reads the contents of a specified directory and outputs it like: pic1.jpg, pic2.jpg, pic3.jpg etc…

I don’t have much experience with actionscript, so I was wondering how I can get flash to load this PHP script and load the returned data into an array like: var img_array=[“pic1.jpg”, “pic2.jpg”, “pic3.jpg”];

So basically I want to read a directory and load the data into flash. Can anyone help or suggest the best way to doing it?