The function is correct, BUT, it looks like you are trying to run this
script off one server and then attempting to "feed" the function a
directory structure off another server.
Your code will work "as-is" if you run the script off my_domain2, but it
won't work if you run it off my_domain asking for a directory structure
located on my_domain2.
I am not sure that opendir() can work like this, and you would probably
need to look at some remote file functions like the ftp functions...
On Mon, 2003-09-15 at 08:38, Andre wrote:
> Hello,
>
> For my website I use some PHP code for navigation. Therefore I use a
> directory structure which contains some navigation files the visitor can
> open. The directory structure looks like this:
>
> my_domain
> |
> - /navigation
> | - file_1.html
> | - file_2.html
> | - file_3.html
> |
> -/images
> :
> :
>
> The name of the files the visitor can open (file_1....file_3) I detect from
> reading the files in the directory "navigation". The function I use is this:
>
> $handle=opendir("./navigation/");
> $counter=0;
>
> while ($file = readdir($handle)) {
>
> $the_type = strrchr($file, ".");
> $is_html = eregi("htm",$the_type);
> if ($file != "." and $file != ".." and $is_html) {
> $newsflash[$counter] = $file;
> $counter++;
>
> }
> }
> closedir($handle);
> rsort($newsflash);
> reset($newsflash);
>
> With some other code I can echo the different files, this code works on the
> same server. Now I want to read the navigation files from a different server
> (my_domain2), then I get an error and the name of the files are not shown.
> When I try it with Apache on my local computer an error is shown on the
> first line
> $handle=opendir("http://domain2/navigation/");
>
> Is there an other way of getting the filenames from a different server? The
> directory structure at my_domain is equal to my_domain2. Apparently the
> function opendir is not correct, can someone help me?
>
> Thanks in advance,
>
> Andr
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php