Re: Finding out which file is retrieved over HTTP
| From: | David Otton | Date: | Sun, 23 Mar 2003 20:32:04 +0000 |
| Subject: | Re: Finding out which file is retrieved over HTTP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140776@lists.php.net to get a copy of this message | ||
On Sun, 23 Mar 2003 21:21:39 +0100, you wrote:
>The following short script retrieves a file over HTTP:
>
>$url = 'http://www.example.com/';
>implode('',file($url)); // or file_get_contents()
>
>Now I'd like to find out which file was really retrieved, for instance
>http://www.example.com/index.html. Is this possible and how?
Difficult - you made a request, and the webserver returned a response.
Whether or not the webserver maps your request to a specific file - or
if it even has any concept of a file - is it's own internal matter.
Having said that, you could try the Content-Location header, and the 3xx
status codes.
>I need to write a small link-checker (Intranet), which reads in all
>links within a file and then looks if they're broken and collects some
>information. Unfortunately I didn't find a simple, free link-checker
>that's why I write my own. It would be good to find out the "complete"
>url, because I want to collect the file-endings (.php,.html, ...).
I really think this already exists. You should probably search a bit
harder.