I recently wrote a script to check a directory from a remote server for instances of specific types of files, then to ensure that a MySQL database contains a unique record for every file of that type found in the remote directory.
First thing I figured out is that you can't use the standard PHP file/directory access functions when you're working with remote files/servers. So I ended up with what I thought was an inelegant workaround:
(1) Verify that the remote directory publishes its contents via HTML (i.e. going to http://the.directory.name/ returns an HTML-formatted file listing with hyperlinks to the files)
(2) Parse all of the URLs found on that page into an array
(3) Walk through that array and process each file name as described above
Is there a simpler way to work with files on remote servers? Something easy that I'm just not seeing?