readdir remote directories, php.ini
Posted: Fri Sep 26, 2003 2:38 pm
I'm using readdir to list local directories and files and it works fine!
But when I try to read remote directories (located in another server, lets say http://www.grn.es/imagic/audio/ readdir does not recognize the directory path.
It seemed, first, to be a problem of "opendir" or of php back slash preferences (\"http:) but I read an interesting quote at:
http://io.spaceports.com/~wysardry/php/ ... files.html
that tells that I must enable "allow_url_fopen" in my local php (4.1.2).
OK, so I must edit the php.ini
Mac OS X does not comes with php.ini You must create one for special purposes... see:
http://www.wellho.net/forum/5660076501.html
So I'm in process of creating a new php.ini to open this unprotected remote directories... or copying the php 4.3.1 php.ini where it must be, reboot the server and risk the experinece...
If there is an easyest way to do so, please post the shortcut! THANKS!
here comes the code:
But when I try to read remote directories (located in another server, lets say http://www.grn.es/imagic/audio/ readdir does not recognize the directory path.
It seemed, first, to be a problem of "opendir" or of php back slash preferences (\"http:) but I read an interesting quote at:
http://io.spaceports.com/~wysardry/php/ ... files.html
that tells that I must enable "allow_url_fopen" in my local php (4.1.2).
OK, so I must edit the php.ini
Mac OS X does not comes with php.ini You must create one for special purposes... see:
http://www.wellho.net/forum/5660076501.html
So I'm in process of creating a new php.ini to open this unprotected remote directories... or copying the php 4.3.1 php.ini where it must be, reboot the server and risk the experinece...
If there is an easyest way to do so, please post the shortcut! THANKS!
here comes the code:
Code: Select all
$path_to_files = '/Library/WebServer/Documents/portal/audio' ; // local dir, works fine!
$path_to_files = 'http://www.grn.es/imagic/audio' ; // remote dir, does not work ;(
if ( $handle = opendir ($path_to_files)) {
echo "Directory handle: $handle \n";
echo "Files:\n" ;
while (false !== ($file = readdir ($handle))) {
echo "$file \n";
}
closedir ($handle);
}