So wheeler, are you sure that it is possible to open the remote directory with opendir() function? Or you have worked with opendir() to open remote directory before? I heard but read anywhere yet it is not possible to open remote file/directory opendir() function.
I can’t seem to get a clear answer either, i’ve been looking for over an hour but can’t find anything much…
some people seem to say u have to use fopen() and regex to read the remote folder contents and filter them, because opendir() doesn’t work remotely - while other sources say you can open remote folders…
Warning: opendir(http://mysite.com/images/) [function.opendir]: failed to open dir: not implemented in C:\\xampp\\htdocs\ est\\ftp.php on line 3
$dir = “http:://mysite.com/images/”;
Warning: opendir(ftp://devraju.com/images/) [function.opendir]: failed to open dir: FTP server reports 2a‘| in C:\\xampp\\htdocs\ est\\ftp.php on line 3
And somewhere in the internet i had found this line before
..... and as you seem to be aware, opendir() works on DIRECTORIES, not URLs. And opendir() only works in local directories of code running system not remove.
No opendir cannot because a remote server does not send a directory listing.
If the server sends an HTML directory listing then you can process that.
Or better yet use FTP, and not FTP is not slow when it comes to files on remote systems FTP was designed for it.
Warning: opendir(ftp://ftp.mysite.com/images) [function.opendir]: failed to open dir: FTP server reports 2a‘| in C:\\xampp\\htdocs\ est\\ftp.php on line 3
thanks for responses, im still skeptical that ftp is a good idea… how could opening up dozens (if not tonnes) of simultaneous ftp connections 24/7 be a speed efficient process compared to http?
I have complete control of both servers, they are both dedicated and sitting side by side… the images are split from the main server for added speed.
I guess it does make sense that opendir() doesn’t work the same remotely as it does locally…
hmm…
a 3rd option would be to store all the file names in the database (half a million and counting) and simply hotlink them in. Of the three options, this is probably the best one as far as I can see. I suppose this also presents further benefits such as storing more file information, but also adds a new layer of complexity.