On Wed, 5 Jun 2002, Erik Fears wrote:
> Is there a way, when requesting remote files (using fopen() or file()) to
> determine the base directory of the file retrieved? For instance, if I did:
> $file = file("http://www.host.com/directory/php";);
> Several things can happen. One is that theres an actual file named php that
> is retrieved. Secondly, php could be a directory and the file index.html is
> retrieved from that directory. Or php could be a directory without an index,
> in which case a directory listing is generated or something to that effect.
> But what I want to be able to do is to determine what the base directory is
> in any case. For instance if php was a file, the base would be
> http://www.host.com/directory/, if it was a directory with an index the base
> would be http://www.host.com/directory/php.
> Anyone know if this information is available?

Not definitively. Sometimes (quite often), if you request something that's
a directory, you'll get a 301 redirecting you to the same URL with the
slash properly appended. Other than that, you're out of luck. Servers can
hand back anything they want in response to any request and there's no
need for them to even have a CONCEPT of file vs. directory, let alone tell
you about it.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to