Re: navigation question
| From: | Andre | Date: | Mon, 15 Sep 2003 13:41:31 +0000 |
| Subject: | Re: navigation question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162631@lists.php.net to get a copy of this message | ||
Thanks for your reaction,
You are right about your conclusion how I think the code should work. I am
indeed trying to run the script off one server (my_domain1) and then
attempting to "feed" the function a directory structure off another server
(my_domain2).
I suppose the function opendir() only work for a directory at the same
server. When someone can tell me what I can do best. Because I just started
with PHP and I read this code in an example, I realy need some help if you
tell me to use ftp.
Andre
"Petre Agenbag" <internet@vsa.co.za> schreef in bericht
news:1063610217.29459.34.camel@petre...
> 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