Here is what I am trying to do. I have URL Directory given below that contains couple of files and I want to list all the file that is in the URL Directory. Please see below for illustration:
URL Directory = http://this_is_my_site/public_files/<br>
file_1.txt<br>
file_2.php<br>
file_3.pdf<br>
file_4.rar<br>
file_5.dwg
Desired result in my localhost
file_1.txt<br>
file_2.php<br>
file_3.pdf<br>
file_4.rar<br>
file_5.dwg
So basically, I just want to loop all the files including their extension from the given URL Directory. I know I can do it from folder to folder locally, but I need to get it from another server which is the given URL Directory.
I have not tried it myself, but the scandir can be the solution for your issue. Let you give it a try.
Usage example:
$directory = <your url path for directory>;
$files = scandir($directory);
Response for the files will be an array of all the files inside given directory.
Note: The method also list .
and ..
for the directory.