Showing results for 
Search instead for 
Did you mean: 

Help with listing a remote directory using PHP

Posts: 33
Registered: ‎10-10-2009

Help with listing a remote directory using PHP

Can anyone give me some pointers on how to generate a list of files in a nominated directory in my main (force9) web space and save that list as a text file in the same directory?
The reason I want to do this is so that a Flash movie (a slideshow) can then read the file list and load in the files (which will all be jpgs).
I know I don't have to do this - I already have the slideshow working by making sure all the jpgs are numbered consecutively and then just manually telling the Flash movie how many there are - what I really want to do is get a bit cleverer than that so I can have the movie load an arbitrary collection of filenames.
It has been suggested to me that a PHP script could generate the file list for me, but I've not done any PHP work before and I can't work out how I can specify the path from a PHP script on the CGI server to the directory on my main web site.
Is this a more complex problem than I'm assuming? Any help would be appreciated.
Posts: 767
Registered: ‎29-10-2008

Re: Help with listing a remote directory using PHP

You could use Curl to get a listing (by http, if your dir doesn't have an index file or an IndexIgnore, or ftp if it does). I don't use Flash, but I think you then have to add ccgi to your crossdomain file.